vai
vai copied to clipboard
undo bunch of insert instead of undo single characters
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".
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.