Fixed merging. Fixed selection undo stack.

This commit is contained in:
Adam Harrison 2021-06-10 11:26:39 -04:00
parent c494d52caf
commit 0f229b039d
2 changed files with 4 additions and 2 deletions

View File

@ -398,10 +398,12 @@ local commands = {
["doc:create-cursor-previous-line"] = function()
split_cursor(-1)
doc():merge_cursors()
end,
["doc:create-cursor-next-line"] = function()
split_cursor(1)
doc():merge_cursors()
end,
}

View File

@ -294,7 +294,7 @@ function Doc:raw_insert(line, col, text, undo_stack, time)
-- push undo
local line2, col2 = self:position_offset(line, col, #text)
push_undo(undo_stack, time, "selection", self:get_selection())
push_undo(undo_stack, time, "selection", unpack(self.selections))
push_undo(undo_stack, time, "remove", line, col, line2, col2)
-- update highlighter and assure selection is in bounds
@ -306,7 +306,7 @@ end
function Doc:raw_remove(line1, col1, line2, col2, undo_stack, time)
-- push undo
local text = self:get_text(line1, col1, line2, col2)
push_undo(undo_stack, time, "selection", self:get_selection())
push_undo(undo_stack, time, "selection", unpack(self.selections))
push_undo(undo_stack, time, "insert", line1, col1, text)
-- get line content before/after removed text