Expand description
A selected text range (could be a range of length zero).
Fields
primary: Cursor
When 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: Cursor
When 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
sourceimpl CursorRange
impl CursorRange
pub fn two(min: Cursor, max: Cursor) -> Self
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) -> Self
sourcepub fn sorted_cursors(&self) -> [Cursor; 2]
pub fn sorted_cursors(&self) -> [Cursor; 2]
returns the two ends ordered
Trait Implementations
sourceimpl Clone for CursorRange
impl Clone for CursorRange
sourcefn clone(&self) -> CursorRange
fn clone(&self) -> CursorRange
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CursorRange
impl Debug for CursorRange
sourceimpl Default for CursorRange
impl Default for CursorRange
sourcefn default() -> CursorRange
fn default() -> CursorRange
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for CursorRange
impl<'de> Deserialize<'de> for CursorRange
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for CursorRange
impl Serialize for CursorRange
impl Copy 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more