Merge pull request #323 from lite-xl/liquidev-multicursor-reset-blink

Reset blink timer when a new cursor is created
This commit is contained in:
Adam 2021-07-04 19:31:40 -04:00 committed by GitHub
commit 1a87d0e4fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -26,7 +26,7 @@ end
local function doc_multiline_selections(sort) local function doc_multiline_selections(sort)
local iter, state, idx, line1, col1, line2, col2 = doc():get_selections(sort) local iter, state, idx, line1, col1, line2, col2 = doc():get_selections(sort)
return function() return function()
idx, line1, col1, line2, col2 = iter(state, idx) idx, line1, col1, line2, col2 = iter(state, idx)
if idx and line2 > line1 and col2 == 1 then if idx and line2 > line1 and col2 == 1 then
line2 = line2 - 1 line2 = line2 - 1
@ -74,6 +74,7 @@ local function split_cursor(direction)
end end
end end
for i,v in ipairs(new_cursors) do doc():add_selection(v[1], v[2]) end for i,v in ipairs(new_cursors) do doc():add_selection(v[1], v[2]) end
core.blink_reset()
end end
local commands = { local commands = {
@ -156,8 +157,8 @@ local commands = {
local line, col = doc():get_selection() local line, col = doc():get_selection()
doc():set_selection(line, col) doc():set_selection(line, col)
end, end,
["doc:indent"] = function() ["doc:indent"] = function()
for idx, line1, col1, line2, col2 in doc_multiline_selections(true) do for idx, line1, col1, line2, col2 in doc_multiline_selections(true) do
local l1, c1, l2, c2 = doc():indent_text(false, line1, col1, line2, col2) local l1, c1, l2, c2 = doc():indent_text(false, line1, col1, line2, col2)
@ -296,7 +297,7 @@ local commands = {
["doc:lower-case"] = function() ["doc:lower-case"] = function()
doc():replace(string.lower) doc():replace(string.lower)
end, end,
["doc:go-to-line"] = function() ["doc:go-to-line"] = function()
local dv = dv() local dv = dv()
@ -370,7 +371,7 @@ local commands = {
end end
end, common.path_suggest) end, common.path_suggest)
end, end,
["file:delete"] = function() ["file:delete"] = function()
local filename = doc().abs_filename local filename = doc().abs_filename
@ -390,7 +391,7 @@ local commands = {
split_cursor(-1) split_cursor(-1)
doc():merge_cursors() doc():merge_cursors()
end, end,
["doc:create-cursor-next-line"] = function() ["doc:create-cursor-next-line"] = function()
split_cursor(1) split_cursor(1)
doc():merge_cursors() doc():merge_cursors()