Expand description
Text editing changeset system (FUTURE ARCHITECTURE - NOT YET IMPLEMENTED)
STATUS: This module defines the planned architecture for a unified text editing changeset system, but is not yet implemented. Current text editing works through:
text3::editmodule for text manipulationmanagers::text_inputfor event recordingwindow.rsfor integration
This module serves as a design document for post-1.0 refactoring.
§Planned Architecture (Future)
This module will implement a two-phase changeset system for all text editing operations:
- Create changesets (pre-callback): Analyze what would change, don’t mutate yet
- Apply changesets (post-callback): Actually mutate state if !preventDefault
This pattern will enable:
- preventDefault support for ALL operations (not just text input)
- Undo/redo stack (record changesets before applying)
- Validation (check bounds, permissions before mutation)
- Inspection (user callbacks can see planned changes)
Structs§
- Text
Changeset - A text editing changeset that can be inspected before application
- Text
OpClear Selection - Clear all selections
- Text
OpCopy - Copy selection to clipboard (no text change)
- Text
OpCut - Cut selection to clipboard (deletes text)
- Text
OpDelete Text - Delete text in range
- Text
OpExtend Selection - Extend selection in a direction
- Text
OpInsert Text - Insert text at cursor position
- Text
OpMove Cursor - Move cursor to new position
- Text
OpPaste - Paste from clipboard (inserts text)
- Text
OpReplace Text - Replace text in range with new text
- Text
OpSelect All - Select all text in node
- Text
OpSet Selection - Set selection to new range
Enums§
- Cursor
Movement - Type of cursor movement
- Selection
Direction - Direction of selection extension
- Text
Operation - Text editing operation (what will change)
Functions§
- create_
copy_ changeset - Creates a copy changeset from the current selection.
- create_
cut_ changeset - Creates a cut changeset from the current selection.
- create_
delete_ selection_ changeset - Creates a delete changeset for the current selection or single character.
- create_
paste_ changeset - Creates a paste changeset at the current cursor position.
- create_
select_ all_ changeset - Creates a select-all changeset for the target node.set for the target node.
Type Aliases§
- Changeset
Id - Unique identifier for a changeset (for undo/redo)