Struct zng_wgt_text::cmd::TextSelectOp

source ·
pub struct TextSelectOp { /* private fields */ }
Expand description

Represents a text selection operation that can be send to an editable text using SELECT_CMD.

Implementations§

source§

impl TextSelectOp

source

pub fn new(op: impl FnMut() + Send + 'static) -> Self

New text select operation.

The editable text widget that handles SELECT_CMD will call op during event handling in the node::layout_text context. You can position the caret using ResolvedText::caret, the text widget will detect changes to it and react accordingly (updating caret position and animation), the caret index is also snapped to the nearest grapheme start.

source

pub fn next() -> Self

Clear selection and move the caret to the next insert index.

This is the Right key operation.

source

pub fn select_next() -> Self

Extend or shrink selection by moving the caret to the next insert index.

This is the SHIFT+Right key operation.

source

pub fn prev() -> Self

Clear selection and move the caret to the previous insert index.

This is the Left key operation.

source

pub fn select_prev() -> Self

Extend or shrink selection by moving the caret to the previous insert index.

This is the SHIFT+Left key operation.

source

pub fn next_word() -> Self

Clear selection and move the caret to the next word insert index.

This is the CTRL+Right shortcut operation.

source

pub fn select_next_word() -> Self

Extend or shrink selection by moving the caret to the next word insert index.

This is the CTRL+SHIFT+Right shortcut operation.

source

pub fn prev_word() -> Self

Clear selection and move the caret to the previous word insert index.

This is the CTRL+Left shortcut operation.

source

pub fn select_prev_word() -> Self

Extend or shrink selection by moving the caret to the previous word insert index.

This is the CTRL+SHIFT+Left shortcut operation.

source

pub fn line_up() -> Self

Clear selection and move the caret to the nearest insert index on the previous line.

This is the Up key operation.

source

pub fn select_line_up() -> Self

Extend or shrink selection by moving the caret to the nearest insert index on the previous line.

This is the SHIFT+Up key operation.

source

pub fn line_down() -> Self

Clear selection and move the caret to the nearest insert index on the next line.

This is the Down key operation.

source

pub fn select_line_down() -> Self

Extend or shrink selection by moving the caret to the nearest insert index on the next line.

This is the SHIFT+Down key operation.

source

pub fn page_up() -> Self

Clear selection and move the caret one viewport up.

This is the PageUp key operation.

source

pub fn select_page_up() -> Self

Extend or shrink selection by moving the caret one viewport up.

This is the SHIFT+PageUp key operation.

source

pub fn page_down() -> Self

Clear selection and move the caret one viewport down.

This is the PageDown key operation.

source

pub fn select_page_down() -> Self

Extend or shrink selection by moving the caret one viewport down.

This is the SHIFT+PageDown key operation.

source

pub fn line_start() -> Self

Clear selection and move the caret to the start of the line.

This is the Home key operation.

source

pub fn select_line_start() -> Self

Extend or shrink selection by moving the caret to the start of the line.

This is the SHIFT+Home key operation.

source

pub fn line_end() -> Self

Clear selection and move the caret to the end of the line (before the line-break if any).

This is the End key operation.

source

pub fn select_line_end() -> Self

Extend or shrink selection by moving the caret to the end of the line (before the line-break if any).

This is the SHIFT+End key operation.

source

pub fn text_start() -> Self

Clear selection and move the caret to the text start.

This is the CTRL+Home shortcut operation.

source

pub fn select_text_start() -> Self

Extend or shrink selection by moving the caret to the text start.

This is the CTRL+SHIFT+Home shortcut operation.

source

pub fn text_end() -> Self

Clear selection and move the caret to the text end.

This is the CTRL+End shortcut operation.

source

pub fn select_text_end() -> Self

Extend or shrink selection by moving the caret to the text end.

This is the CTRL+SHIFT+End shortcut operation.

source

pub fn nearest_to(window_point: DipPoint) -> Self

Clear selection and move the caret to the insert point nearest to the window_point.

This is the mouse primary button down operation.

source

pub fn select_nearest_to(window_point: DipPoint) -> Self

Extend or shrink selection by moving the caret to the insert point nearest to the window_point.

This is the mouse primary button down when holding SHIFT operation.

source

pub fn select_index_nearest_to( window_point: DipPoint, move_selection_index: bool, ) -> Self

Extend or shrink selection by moving the caret index or caret selection index to the insert point nearest to window_point.

This is the touch selection caret drag operation.

source

pub fn select_word_nearest_to( replace_selection: bool, window_point: DipPoint, ) -> Self

Replace or extend selection with the word nearest to the window_point

This is the mouse primary button double click.

source

pub fn select_line_nearest_to( replace_selection: bool, window_point: DipPoint, ) -> Self

Replace or extend selection with the line nearest to the window_point

This is the mouse primary button triple click.

source

pub fn select_all() -> Self

Select the full text.

Trait Implementations§

source§

impl Clone for TextSelectOp

source§

fn clone(&self) -> TextSelectOp

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 TextSelectOp

source§

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

Formats the value using the given formatter. Read more

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FsChangeNote for T
where T: Debug + Any + Send + Sync,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Access any.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

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

§

impl<T> MaybeSendSync for T

source§

impl<T> StateValue for T
where T: Any + Send + Sync,