My Editor Design
Lecture Notes for CS 190
Spring 2016
John Ousterhout
- Text.Tracker:
- General-purpose mechanism, used for several different things.
- TrackedPosition class:
- Subclass of Position
- Automatically updates when text is modified:
- Sticks to character at that position (inserts <= this
position push it out)
- No need to worry about cursor and selection changing location because
of text modifications.
- Selection is always valid, but may be empty
- UndoText: automatically makes text undoable.
- Keeps track of undos in progress, so it won't record new entries for
undo/redo operations.
- Undo grouping:
- Set fences when the insertion cursor is moved
- Don't need many other fences
- Still not ideal; may not scale well as new functions are added