pub enum EditCommand {
Insert {
offset: usize,
text: String,
},
Delete {
start: usize,
length: usize,
},
Replace {
start: usize,
length: usize,
text: String,
},
InsertText {
text: String,
},
InsertTab,
Backspace,
DeleteForward,
Undo,
Redo,
EndUndoGroup,
ReplaceCurrent {
query: String,
replacement: String,
options: SearchOptions,
},
ReplaceAll {
query: String,
replacement: String,
options: SearchOptions,
},
}Expand description
Text editing commands
Variants§
Insert
Insert text at the specified position
Delete
Delete text in specified range
Fields
Replace
Replace text in specified range
Fields
InsertText
VSCode-like typing/paste: apply to all carets/selections (primary + secondary)
InsertTab
Insert a tab at each caret (or replace each selection), using the current tab settings.
- If
TabKeyBehavior::Tab, inserts'\t'. - If
TabKeyBehavior::Spaces, inserts spaces up to the next tab stop.
Backspace
Backspace-like deletion: delete selection(s) if any, otherwise delete 1 char before each caret.
DeleteForward
Delete key-like deletion: delete selection(s) if any, otherwise delete 1 char after each caret.
Undo
Undo last edit operation (supports grouping)
Redo
Redo last undone operation (supports grouping)
EndUndoGroup
Explicitly end the current undo group (for idle or external boundaries)
ReplaceCurrent
Replace the current occurrence of query (based on selection/caret) with replacement.
- Honors
options(case sensitivity / whole-word / regex). - Treated as a single undoable edit.
Fields
options: SearchOptionsSearch options (case sensitivity, whole-word, regex).
ReplaceAll
Replace all occurrences of query with replacement.
- Honors
options(case sensitivity / whole-word / regex). - Treated as a single undoable edit.
Trait Implementations§
Source§impl Clone for EditCommand
impl Clone for EditCommand
Source§fn clone(&self) -> EditCommand
fn clone(&self) -> EditCommand
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more