pub enum EditCommand {
Show 20 variants
Insert {
offset: usize,
text: String,
},
Delete {
start: usize,
length: usize,
},
Replace {
start: usize,
length: usize,
text: String,
},
InsertText {
text: String,
},
InsertTab,
InsertNewline {
auto_indent: bool,
},
Indent,
Outdent,
DeleteToPrevTabStop,
DeleteGraphemeBack,
DeleteGraphemeForward,
DeleteWordBack,
DeleteWordForward,
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.
InsertNewline
Insert a newline at each caret (or replace each selection).
If auto_indent is true, the inserted newline is followed by the leading whitespace
prefix of the current logical line.
Indent
Indent the selected lines (or the current line for an empty selection).
Outdent
Outdent the selected lines (or the current line for an empty selection).
DeleteToPrevTabStop
Smart backspace: if the caret is in leading whitespace, delete back to the previous tab stop.
Otherwise, behaves like EditCommand::Backspace.
DeleteGraphemeBack
Delete the previous Unicode grapheme cluster (UAX #29) for each caret/selection.
DeleteGraphemeForward
Delete the next Unicode grapheme cluster (UAX #29) for each caret/selection.
DeleteWordBack
Delete back to the previous Unicode word boundary (UAX #29) for each caret/selection.
DeleteWordForward
Delete forward to the next Unicode word boundary (UAX #29) for each caret/selection.
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