Enum TextEditAction

Source
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.

Fields

§text: String

Owned UTF-8 content to insert; empty content is a no-op.

§

ImePreedit

Replace the active IME composition state without committing it.

Fields

§preedit: ImePreedit

Composition text and optional byte selection; empty text clears preedit.

§

ImeCommit

Clear preedit and commit text at the selection or caret.

Fields

§text: String

Exact committed UTF-8 content; carriage returns are preserved.

§

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: TextMovement

Direction and granularity of navigation.

§extend: bool

Preserve/create an anchor when true; clear selection when false.

§

SelectAll

Select bytes 0..len and place the caret at the end.

§

SetSelection

Install an explicit selection after clamping both endpoints.

Fields

§selection: TextSelection

Requested anchor and caret byte indices.

§

PointerCaret

Place a caret from pointer hit testing, optionally extending selection.

Fields

§byte: usize

Requested UTF-8 byte index, clamped backward to a valid boundary.

§extend: bool

Preserve/create the selection anchor when true.

§

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.

Fields

§text: String

UTF-8 clipboard content; empty content is a no-op.

§

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

Source§

fn clone(&self) -> TextEditAction

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TextEditAction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TextEditAction

Source§

fn eq(&self, other: &TextEditAction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for TextEditAction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> ErasedDestructor for T
where T: 'static,