Add for config.highlight_current_line new variant: no_selection
This commit is contained in:
parent
2e9619f630
commit
c353dd6eda
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
for lidx, line1, col1, line2, col2 in self.doc:get_selections(false) do
|
local hcl = config.highlight_current_line
|
||||||
if line1 == idx then
|
if hcl ~= false then
|
||||||
draw_highlight = true
|
for lidx, line1, col1, line2, col2 in self.doc:get_selections(false) do
|
||||||
break
|
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
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if draw_highlight and config.highlight_current_line and core.active_view == self then
|
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue