Fixed merging. Fixed selection undo stack.
This commit is contained in:
parent
c494d52caf
commit
0f229b039d
|
@ -398,10 +398,12 @@ local commands = {
|
||||||
|
|
||||||
["doc:create-cursor-previous-line"] = function()
|
["doc:create-cursor-previous-line"] = function()
|
||||||
split_cursor(-1)
|
split_cursor(-1)
|
||||||
|
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()
|
||||||
end,
|
end,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@ function Doc:raw_insert(line, col, text, undo_stack, time)
|
||||||
|
|
||||||
-- push undo
|
-- push undo
|
||||||
local line2, col2 = self:position_offset(line, col, #text)
|
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)
|
push_undo(undo_stack, time, "remove", line, col, line2, col2)
|
||||||
|
|
||||||
-- update highlighter and assure selection is in bounds
|
-- update highlighter and assure selection is in bounds
|
||||||
|
@ -306,7 +306,7 @@ end
|
||||||
function Doc:raw_remove(line1, col1, line2, col2, undo_stack, time)
|
function Doc:raw_remove(line1, col1, line2, col2, undo_stack, time)
|
||||||
-- push undo
|
-- push undo
|
||||||
local text = self:get_text(line1, col1, line2, col2)
|
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)
|
push_undo(undo_stack, time, "insert", line1, col1, text)
|
||||||
|
|
||||||
-- get line content before/after removed text
|
-- get line content before/after removed text
|
||||||
|
|
Loading…
Reference in New Issue