pub enum EditOp {
Show 20 variants
Insert(String),
InsertNewline,
Backdelete,
Delete,
MoveLeft {
select: bool,
},
MoveRight {
select: bool,
},
MoveUp {
select: bool,
},
MoveDown {
select: bool,
},
MoveWordLeft {
select: bool,
},
MoveWordRight {
select: bool,
},
Home {
select: bool,
},
End {
select: bool,
},
SelectAll,
CollapseSelection,
MoveToPoint {
x: f32,
y: f32,
select: bool,
},
SelectWordAtPoint {
x: f32,
y: f32,
},
Compose {
text: String,
cursor: Option<(usize, usize)>,
},
FinishCompose,
ClearCompose,
ApplyEditingState(EditingStateBytes),
}Expand description
A single editing command applied to a TextEditor.
Movement variants carry a select flag: false moves the caret
(collapsing any selection), true extends the selection to the new
position (parley’s move_*/select_* twins).
Variants§
Insert(String)
Insert text, replacing the current selection.
InsertNewline
Insert a literal newline ('\n'), replacing the current selection.
Only meaningful in wrapped multi-line mode (see
TextEditor::set_wrap_width); a single-line field routes Enter to
submit instead of emitting this op.
Backdelete
Delete the grapheme before the caret (Backspace), or the selection.
Delete
Delete the grapheme after the caret (Delete/Forward-delete), or the selection.
MoveLeft
Move/extend one grapheme left (visual order).
MoveRight
Move/extend one grapheme right (visual order).
MoveUp
Move/extend one line up.
MoveDown
Move/extend one line down.
MoveWordLeft
Move/extend one word left.
MoveWordRight
Move/extend one word right.
Home
Move/extend to the start of the line (Home).
End
Move/extend to the end of the line (End).
SelectAll
Select the whole buffer.
CollapseSelection
Collapse the selection to its focus (drop the anchor).
MoveToPoint
Move the caret to (or extend the selection to) a layout-local point.
SelectWordAtPoint
Select the word under a layout-local point (double-click / long-press).
Compose
Begin/update an IME preedit with text and an optional caret range
(byte offsets within text). Desktop/winit composition path.
FinishCompose
Commit the current IME preedit into the buffer. Desktop/winit path.
ClearCompose
Discard the current IME preedit. Desktop/winit path.
ApplyEditingState(EditingStateBytes)
Replace the whole editing value from a platform mirror (Android/iOS
state-sync path). Byte offsets; see EditingStateBytes.