Add for config.highlight_current_line new variant: no_selection

This commit is contained in:
Jipok 2021-12-20 16:20:06 +05:00
parent 2e9619f630
commit c353dd6eda
2 changed files with 15 additions and 5 deletions

View File

@ -13,6 +13,7 @@ config.undo_merge_timeout = 0.3
config.max_undos = 10000 config.max_undos = 10000
config.max_tabs = 8 config.max_tabs = 8
config.always_show_tabs = true config.always_show_tabs = true
-- Possible values: false, true, "no_selection"
config.highlight_current_line = true config.highlight_current_line = true
config.line_height = 1.2 config.line_height = 1.2
config.indent_size = 2 config.indent_size = 2

View File

@ -331,13 +331,22 @@ end
function DocView:draw_line_body(idx, x, y) function DocView:draw_line_body(idx, x, y)
-- draw highlight if any selection ends on this line -- draw highlight if any selection ends on this line
local draw_highlight = false local draw_highlight = false
local hcl = config.highlight_current_line
if hcl ~= false then
for lidx, line1, col1, line2, col2 in self.doc:get_selections(false) do for lidx, line1, col1, line2, col2 in self.doc:get_selections(false) do
if line1 == idx then if line1 == idx then
if hcl == "no_selection" then
if (line1 ~= line2) or (col1 ~= col2) then
draw_highlight = false
break
end
end
draw_highlight = true draw_highlight = true
break break
end end
end end
if draw_highlight and config.highlight_current_line and core.active_view == self then end
if draw_highlight and core.active_view == self then
self:draw_line_highlight(x + self.scroll.x, y) self:draw_line_highlight(x + self.scroll.x, y)
end end