pub enum TextEditAction {
Show 16 variants
InsertText {
text: String,
},
ImePreedit {
preedit: ImePreedit,
},
ImeCommit {
text: String,
},
ImeEnd,
DeleteBackward,
DeleteForward,
Move {
movement: TextMovement,
extend: bool,
},
SelectAll,
SetSelection {
selection: TextSelection,
},
PointerCaret {
byte: usize,
extend: bool,
},
Copy,
Cut,
Paste {
text: String,
},
RequestPaste,
Undo,
Redo,
}Expand description
Editing command applied to a buffer through TextEditState.
Actions are backend-neutral: clipboard reads/writes are reported in
TextEditOutcome for the host widget to perform. Directly constructed
actions are not restricted by TextInputMode.
§Examples
use ailloli_ui_text::{TextBuffer, TextEditAction, TextEditState};
let mut buffer = TextBuffer::new();
let mut state = TextEditState::new();
state.apply(&mut buffer, TextEditAction::InsertText { text: "hello".into() });
assert_eq!(buffer.as_str(), "hello");Variants§
InsertText
Replace the selection or insert committed text at the caret.
Carriage returns in text are individually normalized to newlines.
ImePreedit
Replace the active IME composition state without committing it.
Fields
preedit: ImePreeditComposition text and optional byte selection; empty text clears preedit.
ImeCommit
Clear preedit and commit text at the selection or caret.
ImeEnd
Clear an active IME preedit without mutating committed text.
DeleteBackward
Delete a nonempty selection or the preceding extended grapheme cluster.
DeleteForward
Delete a nonempty selection or the following extended grapheme cluster.
Move
Move the caret in logical document space.
Fields
movement: TextMovementDirection and granularity of navigation.
SelectAll
Select bytes 0..len and place the caret at the end.
SetSelection
Install an explicit selection after clamping both endpoints.
Fields
selection: TextSelectionRequested anchor and caret byte indices.
PointerCaret
Place a caret from pointer hit testing, optionally extending selection.
Fields
Copy
Request writing the selected text to the host clipboard.
Cut
Request a clipboard write and delete a nonempty selection.
Paste
Insert exact host-provided clipboard content.
RequestPaste
Request asynchronous clipboard text from the host.
Undo
Restore the newest whole-buffer undo snapshot if present.
Redo
Restore the newest whole-buffer redo snapshot if present.
Trait Implementations§
Source§impl Clone for TextEditAction
impl Clone for TextEditAction
Source§fn clone(&self) -> TextEditAction
fn clone(&self) -> TextEditAction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more