the .toString
of this object, except by making it separate we force
the implementer to provide something and stop them from accidentally
leaving it as the meaningless default.
the .toString
of this object, except by making it separate we force
the implementer to provide something and stop them from accidentally
leaving it as the meaningless default.
An enum representing what the user is "currently" doing.
An enum representing what the user is "currently" doing. Used to collapse sequential actions into one undo step: e.g. 10 plain chars typed becomes 1 undo step, or 10 chars deleted becomes one undo step, but 4 chars typed followed by 3 chars deleted followed by 3 chars typed gets grouped into 3 different undo steps
The current stack of states that undo/redo would cycle through.
The current stack of states that undo/redo would cycle through.
Not really the appropriate data structure, since when it reaches
maxUndo
in length we remove one element from the start whenever we
append one element to the end, which costs O(n)
. On the other hand,
It also costs O(n)
to maintain the buffer of previous states, and
so n
is probably going to be pretty small anyway (tens?) so O(n)
is perfectly fine.
The current position in the undoStack that the terminal is currently in.
A filter that implements "undo" functionality in the ammonite REPL. It shares the same
Ctrl -
hotkey that the bash undo, but shares behavior with the undo behavior in desktop text editors:- Multiple
delete
s in a row get collapsed - In addition to edits you can undo cursor movements: undo will bring your cursor back to location of previous edits before it undoes them - Provides "redo" functionality underAlt -
/Esc -
: un-undo the things you didn't actually want to undo!