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
impl TextSelectOp
sourcepub fn new(op: impl FnMut() + Send + 'static) -> Self
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.
sourcepub fn next() -> Self
pub fn next() -> Self
Clear selection and move the caret to the next insert index.
This is the Right
key operation.
sourcepub fn select_next() -> Self
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.
sourcepub fn prev() -> Self
pub fn prev() -> Self
Clear selection and move the caret to the previous insert index.
This is the Left
key operation.
sourcepub fn select_prev() -> Self
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.
sourcepub fn next_word() -> Self
pub fn next_word() -> Self
Clear selection and move the caret to the next word insert index.
This is the CTRL+Right
shortcut operation.
sourcepub fn select_next_word() -> Self
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.
sourcepub fn prev_word() -> Self
pub fn prev_word() -> Self
Clear selection and move the caret to the previous word insert index.
This is the CTRL+Left
shortcut operation.
sourcepub fn select_prev_word() -> Self
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.
sourcepub fn line_up() -> Self
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.
sourcepub fn select_line_up() -> Self
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.
sourcepub fn line_down() -> Self
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.
sourcepub fn select_line_down() -> Self
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.
sourcepub fn page_up() -> Self
pub fn page_up() -> Self
Clear selection and move the caret one viewport up.
This is the PageUp
key operation.
sourcepub fn select_page_up() -> Self
pub fn select_page_up() -> Self
Extend or shrink selection by moving the caret one viewport up.
This is the SHIFT+PageUp
key operation.
sourcepub fn page_down() -> Self
pub fn page_down() -> Self
Clear selection and move the caret one viewport down.
This is the PageDown
key operation.
sourcepub fn select_page_down() -> Self
pub fn select_page_down() -> Self
Extend or shrink selection by moving the caret one viewport down.
This is the SHIFT+PageDown
key operation.
sourcepub fn line_start() -> Self
pub fn line_start() -> Self
Clear selection and move the caret to the start of the line.
This is the Home
key operation.
sourcepub fn select_line_start() -> Self
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.
sourcepub fn line_end() -> Self
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.
sourcepub fn select_line_end() -> Self
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.
sourcepub fn text_start() -> Self
pub fn text_start() -> Self
Clear selection and move the caret to the text start.
This is the CTRL+Home
shortcut operation.
sourcepub fn select_text_start() -> Self
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.
sourcepub fn text_end() -> Self
pub fn text_end() -> Self
Clear selection and move the caret to the text end.
This is the CTRL+End
shortcut operation.
sourcepub fn select_text_end() -> Self
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.
sourcepub fn nearest_to(window_point: DipPoint) -> Self
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.
sourcepub fn select_nearest_to(window_point: DipPoint) -> Self
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.
sourcepub fn select_index_nearest_to(
window_point: DipPoint,
move_selection_index: bool,
) -> Self
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.
sourcepub fn select_word_nearest_to(
replace_selection: bool,
window_point: DipPoint,
) -> Self
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.
sourcepub fn select_line_nearest_to(
replace_selection: bool,
window_point: DipPoint,
) -> Self
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.
sourcepub fn select_all() -> Self
pub fn select_all() -> Self
Select the full text.
Trait Implementations§
source§impl Clone for TextSelectOp
impl Clone for TextSelectOp
source§fn clone(&self) -> TextSelectOp
fn clone(&self) -> TextSelectOp
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for TextSelectOp
impl !RefUnwindSafe for TextSelectOp
impl Send for TextSelectOp
impl Sync for TextSelectOp
impl Unpin for TextSelectOp
impl !UnwindSafe for TextSelectOp
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FsChangeNote for T
impl<T> FsChangeNote for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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