From af68c397bc9b2babc1e7d70a6ca465501f392df6 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 12 Dec 2024 20:12:11 +0100 Subject: [PATCH] fix: rendering of minimode separator --- src/renderer/vaxis/Plane.zig | 6 ++++++ src/tui/status/modestate.zig | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/renderer/vaxis/Plane.zig b/src/renderer/vaxis/Plane.zig index b778f2e..030b72e 100644 --- a/src/renderer/vaxis/Plane.zig +++ b/src/renderer/vaxis/Plane.zig @@ -351,6 +351,12 @@ fn apply_alpha_theme(base: ThemeColor, col: ThemeColor) vaxis.Cell.Color { .{ .rgb = color.apply_alpha(RGB.from_u24(base.color), RGB.from_u24(col.color), alpha).to_u8s() }; } +pub inline fn reverse_style(self: *Plane) void { + const swap = self.style.fg; + self.style.fg = self.style.bg; + self.style.bg = swap; +} + pub inline fn set_style(self: *Plane, style_: Style) void { if (style_.fg) |col| self.style.fg = apply_alpha(self.style_base.fg, col); if (style_.bg) |col| self.style.bg = apply_alpha(self.style_base.bg, col); diff --git a/src/tui/status/modestate.zig b/src/tui/status/modestate.zig index 0e285d9..d89c68d 100644 --- a/src/tui/status/modestate.zig +++ b/src/tui/status/modestate.zig @@ -68,9 +68,9 @@ pub fn render(_: *void, self: *Button.State(void), theme: *const Widget.Theme) b } fn render_separator(self: *Button.State(void), theme: *const Widget.Theme) void { - const statusbar_bg = theme.statusbar.bg orelse theme.editor.bg.?; - if (theme.statusbar_hover.bg) |bg| self.plane.set_fg_rgb_alpha(statusbar_bg, bg) catch {}; - if (theme.statusbar.bg) |bg| self.plane.set_bg_rgb_alpha(statusbar_bg, bg) catch {}; + self.plane.reverse_style(); + self.plane.set_base_style(.{ .bg = theme.editor.bg }); + if (theme.statusbar.bg) |bg| self.plane.set_style(.{ .bg = bg }); _ = self.plane.putstr("") catch {}; }