Skip to main content

TextEditRequest

Enum TextEditRequest 

Source
pub enum TextEditRequest {
Show 14 variants Insert { entity: Entity, at: TextPos, text: Arc<str>, }, Delete { entity: Entity, range: Range<usize>, }, Replace { entity: Entity, range: Range<usize>, text: Arc<str>, }, MoveCursor { entity: Entity, motion: CursorMotion, mode: MoveMode, }, Select { entity: Entity, range: Range<usize>, }, SetCursor { entity: Entity, pos: TextPos, }, ExtendSelection { entity: Entity, pos: TextPos, }, SelectAll { entity: Entity, }, Undo { entity: Entity, }, Redo { entity: Entity, }, ImeBegin { entity: Entity, }, ImeUpdate { entity: Entity, text: Arc<str>, caret_in_preedit: usize, }, ImeCommit { entity: Entity, text: Arc<str>, replace_range: Option<Range<usize>>, }, ImeCancel { entity: Entity, },
}
Expand description

One text-editing request addressed to entity’s crate::text_model::TextBuffer.

Producers write into a bevy_ecs::message::Messages queue; the single [lumen_text_edit::text_apply_edits] system drains them.

Variants§

§

Insert

Insert text at at.

Fields

§entity: Entity

Target editable.

§at: TextPos

Resolved insertion position.

§text: Arc<str>

Inserted bytes (Arc’d so producers don’t always allocate).

§

Delete

Delete the byte range.

Fields

§entity: Entity

Target editable.

§range: Range<usize>

Range to delete, in bytes.

§

Replace

Replace range with text (IME’s replacementStart/Length).

Fields

§entity: Entity

Target editable.

§range: Range<usize>

Range to replace, in bytes.

§text: Arc<str>

Replacement bytes.

§

MoveCursor

Move the cursor.

Fields

§entity: Entity

Target editable.

§motion: CursorMotion

Motion axis.

§mode: MoveMode

Selection modifier.

§

Select

Set selection range (in bytes).

Fields

§entity: Entity

Target editable.

§range: Range<usize>

Range of bytes to select.

§

SetCursor

Set cursor to an explicit position (collapses selection).

Fields

§entity: Entity

Target editable.

§pos: TextPos

New cursor position.

§

ExtendSelection

Move the selection head to pos while keeping the current anchor (Shift+click, pointer drag). Unlike Self::Select the anchor side is preserved, so repeated extends pivot around the same fixed end regardless of direction.

Fields

§entity: Entity

Target editable.

§pos: TextPos

New selection head.

§

SelectAll

Select all.

Fields

§entity: Entity

Target editable.

§

Undo

Pop one entry off the undo stack.

Fields

§entity: Entity

Target editable.

§

Redo

Re-apply the next redo entry.

Fields

§entity: Entity

Target editable.

§

ImeBegin

Begin an IME composition (no-op if already active).

Fields

§entity: Entity

Target editable.

§

ImeUpdate

Update the IME preedit.

Fields

§entity: Entity

Target editable.

§text: Arc<str>

New preedit string.

§caret_in_preedit: usize

Caret byte offset inside text.

§

ImeCommit

Commit the IME preedit; replaces replace_range with text if replace_range is Some, otherwise inserts text at the cursor.

Fields

§entity: Entity

Target editable.

§text: Arc<str>

Final text.

§replace_range: Option<Range<usize>>

Optional IME-requested replacement range (W3.5).

§

ImeCancel

Cancel any active IME preedit without committing.

Fields

§entity: Entity

Target editable.

Implementations§

Source§

impl TextEditRequest

Source

pub fn entity(&self) -> Entity

The target entity of this request.

Trait Implementations§

Source§

impl Clone for TextEditRequest

Source§

fn clone(&self) -> TextEditRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TextEditRequest

Source§

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

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

impl Message for TextEditRequest
where Self: Send + Sync + 'static,

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.

§

impl<T> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
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> ConditionalSend for T
where T: Send,