From a0d9dede1873494bce0e153bc804b6971e66418d Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 18 Dec 2024 16:22:56 +0100 Subject: [PATCH] feat: hide line highlight when selecting if theme requires it --- src/tui/editor.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 419dd9e..b8453cb 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -831,7 +831,14 @@ pub const Editor = struct { return Buffer.Walker.keep_walking; } }; - const hl_row: ?usize = if (tui.current().config.highlight_current_line) self.get_primary().cursor.row else null; + const hl_row: ?usize = if (tui.current().config.highlight_current_line) blk: { + if (self.get_primary().selection) |_| + if (theme.editor_selection.bg) |sel_bg| + if (theme.editor_line_highlight.bg) |hl_bg| + if (sel_bg.color == hl_bg.color and sel_bg.alpha == hl_bg.alpha) + break :blk null; + break :blk self.get_primary().cursor.row; + } else null; var ctx_: ctx = .{ .self = self, .buf_row = self.view.row, .theme = theme, .hl_row = hl_row }; const root = self.buf_root() catch return;