mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-30 04:37:29 -06:00
While the Type tool edits type, Edit > Undo and Redo (the menu, the keyboard, the History panel and MCP all run edit.undo and edit.redo) left the caret at its byte offset, clamped to the text. Typing "abc" before "XYZ" and pressing Undo left the caret after "XYZ". The engine now tells the active tool about edit.undo and edit.redo before it finishes the command. The Type tool keeps the edited text and a list of the steps that changed it, and puts the caret, with nothing selected, at the end of the span the step changed: where typed text began after its Undo, after restored text after the Undo of a deletion, and after retyped text after Redo. For the steps the tool made, it keeps where the span ended, so text that repeats the characters next to it puts the caret at the right end. A step that changes no characters, such as a formatting change, leaves the caret and the selection as they are. Typed lists keep their caret positions.