Add option to disable caret blinking (#572)

This commit is contained in:
Guldoman 2021-10-02 16:38:10 +02:00 committed by GitHub
parent 3b280401e4
commit b5f0b340d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,10 +411,12 @@ 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
local x, y = self:get_line_screen_position(line)
self:draw_caret(x + self:get_col_x_offset(line, col), y)
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