Struct comfy_wgpu::egui::widgets::text_edit::CursorRange
source · pub struct CursorRange {
pub primary: Cursor,
pub secondary: Cursor,
}Expand description
A selected text range (could be a range of length zero).
Fields§
§primary: CursorWhen selecting with a mouse, this is where the mouse was released. When moving with e.g. shift+arrows, this is what moves. Note that the two ends can come in any order, and also be equal (no selection).
secondary: CursorWhen selecting with a mouse, this is where the mouse was first pressed. This part of the cursor does not move when shift is down.
Implementations§
source§impl CursorRange
impl CursorRange
sourcepub fn one(cursor: Cursor) -> CursorRange
pub fn one(cursor: Cursor) -> CursorRange
The empty range.
pub fn two(min: Cursor, max: Cursor) -> CursorRange
pub fn as_ccursor_range(&self) -> CCursorRange
sourcepub fn as_sorted_char_range(&self) -> Range<usize> ⓘ
pub fn as_sorted_char_range(&self) -> Range<usize> ⓘ
The range of selected character indices.
sourcepub fn single(&self) -> Option<Cursor>
pub fn single(&self) -> Option<Cursor>
If there is a selection, None is returned. If the two ends is the same, that is returned.
pub fn is_sorted(&self) -> bool
pub fn sorted(self) -> CursorRange
sourcepub fn sorted_cursors(&self) -> [Cursor; 2]
pub fn sorted_cursors(&self) -> [Cursor; 2]
returns the two ends ordered
Trait Implementations§
source§impl Clone for CursorRange
impl Clone for CursorRange
source§fn clone(&self) -> CursorRange
fn clone(&self) -> CursorRange
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for CursorRange
impl Debug for CursorRange
source§impl Default for CursorRange
impl Default for CursorRange
source§fn default() -> CursorRange
fn default() -> CursorRange
Returns the “default value” for a type. Read more
source§impl PartialEq<CursorRange> for CursorRange
impl PartialEq<CursorRange> for CursorRange
source§fn eq(&self, other: &CursorRange) -> bool
fn eq(&self, other: &CursorRange) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl Copy for CursorRange
impl StructuralPartialEq for CursorRange
Auto Trait Implementations§
impl RefUnwindSafe for CursorRange
impl Send for CursorRange
impl Sync for CursorRange
impl Unpin for CursorRange
impl UnwindSafe for CursorRange
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
Mutably borrows from an owned value. Read more