feat: set undercurl color for diagnostics

This commit is contained in:
CJ van den Berg 2024-07-09 21:16:16 +02:00
parent 4b694d4f0f
commit 0caeb2c523
3 changed files with 8 additions and 3 deletions

View file

@ -32,8 +32,8 @@
.hash = "122019f077d09686b1ec47928ca2b4bf264422f3a27afc5b49dafb0129a4ceca0d01",
},
.vaxis = .{
.url = "https://github.com/neurocyte/libvaxis/archive/168ac86215ee91b51f99026a32602e88f0ed53d8.tar.gz",
.hash = "1220e0d1a1816c4b0d1f312f3dabed16560e0946e6fd92b73ffa21aa1202e82843fc",
.url = "https://github.com/rockorager/libvaxis/archive/40e51ad0542ea964190db411292660c274e2a984.tar.gz",
.hash = "12200ade9c84de359ac4a83645bda328342df7d2e288f2e2d966895b9b9f50da6b01",
},
.zg = .{
.url = "git+https://codeberg.org/dude_the_builder/zg#6d2ba3ff8f3cb7c86cef2b2176fb5b4a72c104dc",

View file

@ -30,6 +30,10 @@ pub inline fn set_style(self: *Cell, style_: Style) void {
}
}
pub inline fn set_under_color(self: *Cell, arg_rgb: c_uint) void {
self.cell.style.ul = vaxis.Cell.Color.rgbFromUint(@intCast(arg_rgb));
}
pub inline fn set_style_fg(self: *Cell, style_: Style) void {
if (style_.fg) |fg| self.cell.style.fg = vaxis.Cell.Color.rgbFromUint(fg);
}

View file

@ -878,9 +878,10 @@ pub const Editor = struct {
_ = self.plane.print_aligned_right(@intCast(y), "{s}", .{message[0..@min(max_space, message.len)]}) catch {};
}
inline fn render_diagnostic_cell(self: *Self, _: Widget.Theme.Style) void {
inline fn render_diagnostic_cell(self: *Self, style: Widget.Theme.Style) void {
var cell = self.plane.cell_init();
_ = self.plane.at_cursor_cell(&cell) catch return;
if (style.fg) |ul_col| cell.set_under_color(ul_col);
cell.set_style(.{ .fs = .undercurl });
_ = self.plane.putc(&cell) catch {};
}