From 3ef7a003366aea89827417e4a3ed7135feca6cd4 Mon Sep 17 00:00:00 2001 From: Joshua Minor Date: Sat, 27 Nov 2021 21:48:25 -0800 Subject: Highlight the cursor and selection in minimap. --- plugins/minimap.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'plugins/minimap.lua') diff --git a/plugins/minimap.lua b/plugins/minimap.lua index b129f40..32bcf6f 100644 --- a/plugins/minimap.lua +++ b/plugins/minimap.lua @@ -222,6 +222,15 @@ DocView.draw_scrollbar = function(self) -- draw visual rect renderer.draw_rect(x, visible_y, w, scroller_height, visual_color) + -- highlight the selected lines, and the line with the caret on it + local selection_line, selection_col, selection_line2, selection_col2 = self.doc:get_selection() + local selection_y = y + (selection_line - minimap_start_line) * line_spacing + local selection2_y = y + (selection_line2 - minimap_start_line) * line_spacing + local selection_min_y = math.min(selection_y, selection2_y) + local selection_h = math.abs(selection2_y - selection_y)+1 + renderer.draw_rect(x, selection_min_y, w, selection_h, style.dim) + renderer.draw_rect(x, selection_y, w, line_spacing, style.accent) + local highlight_align = config.plugins.minimap.highlight_align local highlight_width = config.plugins.minimap.highlight_width local gutter_width = config.plugins.minimap.gutter_width -- cgit v1.2.3