From 844f8abc445a46aba3c4988518d4ea309417cb46 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Sat, 30 Apr 2022 06:30:01 +0200 Subject: `selectionhighlight`: Don't draw box around the selection --- plugins/selectionhighlight.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/selectionhighlight.lua b/plugins/selectionhighlight.lua index 25a6125..19bc475 100644 --- a/plugins/selectionhighlight.lua +++ b/plugins/selectionhighlight.lua @@ -31,10 +31,13 @@ function DocView:draw_line_body(idx, x, y) selected_text, last_col, true ) if start_col == nil then break end - local x1 = x + self:get_col_x_offset(idx, start_col) - local x2 = x + self:get_col_x_offset(idx, end_col + 1) - local color = style.selectionhighlight or style.syntax.comment - draw_box(x1, y, x2 - x1, lh, color) + -- don't draw box around the selection + if idx ~= line1 or start_col ~= col1 then + local x1 = x + self:get_col_x_offset(idx, start_col) + local x2 = x + self:get_col_x_offset(idx, end_col + 1) + local color = style.selectionhighlight or style.syntax.comment + draw_box(x1, y, x2 - x1, lh, color) + end last_col = end_col + 1 end end -- cgit v1.2.3