Add option to disable caret blinking (#572)

This commit is contained in:
Guldoman 2021-10-02 16:38:10 +02:00 committed by Francesco Abbate
parent 468229e4d0
commit 57bfb67f6a
2 changed files with 6 additions and 3 deletions

View File

@ -24,6 +24,7 @@ config.max_project_files = 2000
config.transitions = true
config.animation_rate = 1.0
config.blink_period = 0.8
config.disable_blink = false
config.draw_whitespace = false
config.borderless = false
config.tab_close_button = true

View File

@ -411,14 +411,16 @@ function DocView:draw_overlay()
local T = config.blink_period
for _, line, col in self.doc:get_selections() do
if line >= minline and line <= maxline
and (core.blink_timer - core.blink_start) % T < T / 2
and system.window_has_focus() then
if config.disable_blink
or (core.blink_timer - core.blink_start) % T < T / 2 then
local x, y = self:get_line_screen_position(line)
self:draw_caret(x + self:get_col_x_offset(line, col), y)
end
end
end
end
end
function DocView:draw()
self:draw_background(style.background)