Move lineguide below blinking cursor, fixes #1488 (#1511)

* Move lineguide below blinking cursor, fixes #1488

* Added config_spec custom color
This commit is contained in:
Jefferson González 2023-05-17 07:14:28 -07:00 committed by George Sokianos
parent 363b102abc
commit ba753593f3
1 changed files with 22 additions and 4 deletions

View File

@ -15,6 +15,8 @@ config.plugins.lineguide = common.merge({
-- 120, -- 120,
config.line_limit config.line_limit
}, },
use_custom_color = false,
custom_color = style.selection,
-- The config specification used by gui generators -- The config specification used by gui generators
config_spec = { config_spec = {
name = "Line Guide", name = "Line Guide",
@ -63,7 +65,21 @@ config.plugins.lineguide = common.merge({
end end
return new_rulers return new_rulers
end end
} },
{
label = "Use Custom Color",
description = "Enable the utilization of a custom line color.",
path = "use_custom_color",
type = "toggle",
default = false
},
{
label = "Custom Color",
description = "Applied when the above toggle is enabled.",
path = "custom_color",
type = "color",
default = style.selection
},
} }
}, config.plugins.lineguide) }, config.plugins.lineguide)
@ -79,8 +95,6 @@ end
local draw_overlay = DocView.draw_overlay local draw_overlay = DocView.draw_overlay
function DocView:draw_overlay(...) function DocView:draw_overlay(...)
draw_overlay(self, ...)
if if
type(config.plugins.lineguide) == "table" type(config.plugins.lineguide) == "table"
and and
@ -88,10 +102,12 @@ function DocView:draw_overlay(...)
and and
self:is(DocView) self:is(DocView)
then then
local conf = config.plugins.lineguide
local line_x = self:get_line_screen_position(1) local line_x = self:get_line_screen_position(1)
local character_width = self:get_font():get_width("n") local character_width = self:get_font():get_width("n")
local ruler_width = config.plugins.lineguide.width local ruler_width = config.plugins.lineguide.width
local ruler_color = style.guide or style.selection local ruler_color = conf.use_custom_color and conf.custom_color
or (style.guide or style.selection)
for k,v in ipairs(config.plugins.lineguide.rulers) do for k,v in ipairs(config.plugins.lineguide.rulers) do
local ruler = get_ruler(v) local ruler = get_ruler(v)
@ -106,6 +122,8 @@ function DocView:draw_overlay(...)
end end
end end
end end
-- everything else like the cursor above the line guides
draw_overlay(self, ...)
end end
command.add(nil, { command.add(nil, {