vai icon indicating copy to clipboard operation
vai copied to clipboard

undo bunch of insert instead of undo single characters

Open syntonym opened this issue 9 years ago • 1 comments

Currently undo does not undo an "insert" but instead undos single characters. Entering insert mode, typing something and then leaving insert mode should probably be treated as a single "do-event".

syntonym avatar May 03 '15 21:05 syntonym

Possible solutions would be to pack the insertion events as they are added to the history queue. Otherwise we need to keep track of many changes at once on the TextDocument without using the command classes, which would probably prove nasty.

Every time a new Insert command is pushed into the command history, the command history checks the top of the undo queue. If the commands are compatible (eg. are both insert event), then we issue merged = command1.merge(command2) , and push merged back into the queue.

stefanoborini avatar May 03 '15 21:05 stefanoborini