diff options
author | Joshua Minor <github@pixelverse.org> | 2021-11-27 21:48:25 -0800 |
---|---|---|
committer | Joshua Minor <github@pixelverse.org> | 2021-11-27 21:52:55 -0800 |
commit | 3ef7a003366aea89827417e4a3ed7135feca6cd4 (patch) | |
tree | bac86959a145c621c406f7ef37a69c47a435971b /plugins | |
parent | ecdb7919b2fa4861d8cc3507ad2db18c6aab47f4 (diff) | |
download | lite-xl-plugins-3ef7a003366aea89827417e4a3ed7135feca6cd4.tar.gz lite-xl-plugins-3ef7a003366aea89827417e4a3ed7135feca6cd4.zip |
Highlight the cursor and selection in minimap.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/minimap.lua | 9 |
1 files changed, 9 insertions, 0 deletions
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 |