pub struct CCursor {
pub index: CharIndex,
pub prefer_next_row: bool,
}egui only.Expand description
Character cursor.
The default cursor is zero.
Fields§
§index: CharIndexCharacter offset (NOT byte offset!).
prefer_next_row: boolIf this cursors sits right at the border of a wrapped row break (NOT paragraph break) do we prefer the next row? This is almost always what you want, except for when explicitly clicking the end of a row or pressing the end key.
Implementations§
Source§impl CCursor
impl CCursor
Sourcepub fn new(index: impl Into<CharIndex>) -> CCursor
pub fn new(index: impl Into<CharIndex>) -> CCursor
A cursor at the given character offset.
NOTE: index is a character offset (i.e. counting chars), NOT a byte offset!
For instance, the cursor after "ö" is at CCursor::new(1), even though "ö".len() == 2.
To put the cursor after the last character of a string, use Self::end_of_str.
Sourcepub fn end_of_str(text: &str) -> CCursor
pub fn end_of_str(text: &str) -> CCursor
A cursor placed after the last character of text,
i.e. at text.chars().count().
Trait Implementations§
Source§impl AddAssign<usize> for CCursor
impl AddAssign<usize> for CCursor
Source§fn add_assign(&mut self, rhs: usize)
fn add_assign(&mut self, rhs: usize)
+= operation. Read moreimpl Copy for CCursor
Source§impl PartialEq for CCursor
Two CCursors are considered equal if they refer to the same character boundary,
even if one prefers the start of the next row.
impl PartialEq for CCursor
Two CCursors are considered equal if they refer to the same character boundary,
even if one prefers the start of the next row.
Auto Trait Implementations§
impl Forget for CCursor
impl Freeze for CCursor
impl Move for CCursor
impl RefUnwindSafe for CCursor
impl Send for CCursor
impl Sync for CCursor
impl Unpin for CCursor
impl UnsafeUnpin for CCursor
impl UnwindSafe for CCursor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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