Expand description
Editor state, editing commands, syntax integration, and rendering glue.
EditorState intentionally remains the compatibility-facing façade for now,
but its state falls into several distinct responsibility groups:
- document text, cursor/selection, and undo/redo history;
- file loading and saving;
- syntax parsing, highlighting, and fold ranges;
- search and replace;
- layout, scrolling, blinking, and pointer interaction; and
- GPUI input handling and rendering coordination.
The main invariants to preserve during future extraction are:
ropealways contains a trailing newline (including an empty document).- Cursor and selection byte offsets are always clamped to UTF-8 boundaries.
- A content or language change invalidates older asynchronous parse results.
- A content change invalidates older asynchronous search results.
- Replacing a selection or all search matches is one undoable operation.
- Fold ranges and index-keyed layout caches are migrated or invalidated when edits change line structure.
Future refactoring should extract low-coupling state first (BlinkState,
SearchState, and InteractionState), while keeping EditorState as the
public façade. The document/editing core and the render snapshot should only
be split after the behavior tests below cover their current contracts.
Structs§
- Backspace
- Copy
- Cut
- Delete
- Delete
Word - Editor
- Editor
Diagnostic - Editor
State - Enter
- Fold
Range - Move
Down - Move
Left - Move
Right - Move
ToDoc End - Move
ToDoc Start - Move
ToLine End - Move
ToLine Start - MoveUp
- Move
Word Left - Move
Word Right - Page
Down - PageUp
- Paste
- Position
- Redo
- Select
All - Select
Down - Select
Left - Select
Right - Select
ToLine End - Select
ToLine Start - Select
Up - Selection
- Tab
- Undo