Skip to main content

Module changeset

Module changeset 

Source
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::edit module for text manipulation
  • managers::text_input for event recording
  • window.rs for 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:

  1. Create changesets (pre-callback): Analyze what would change, don’t mutate yet
  2. 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§

TextChangeset
A text editing changeset that can be inspected before application
TextOpClearSelection
Clear all selections
TextOpCopy
Copy selection to clipboard (no text change)
TextOpCut
Cut selection to clipboard (deletes text)
TextOpDeleteText
Delete text in range
TextOpExtendSelection
Extend selection in a direction
TextOpInsertText
Insert text at cursor position
TextOpMoveCursor
Move cursor to new position
TextOpPaste
Paste from clipboard (inserts text)
TextOpReplaceText
Replace text in range with new text
TextOpSelectAll
Select all text in node
TextOpSetSelection
Set selection to new range

Enums§

CursorMovement
Type of cursor movement
SelectionDirection
Direction of selection extension
TextOperation
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§

ChangesetId
Unique identifier for a changeset (for undo/redo)