pub struct NearbyWord {
pub word: String,
pub byte_start: usize,
pub byte_end: usize,
pub caret_offset_chars: i32,
}Expand description
A word the buffer holds near (but not necessarily at) the
caret, with the offset metadata needed to navigate there and
replace it. Returned by Buffer::words_near_caret; the
corrector uses these to recover when the buffer caret has
drifted a few chars from the visible cursor (held auto-repeat,
mouse click, etc.) and the picked word_at_caret turns out to
be fine.
Fields§
§word: StringThe word itself.
byte_start: usizeByte position of the word’s START in the buffer’s text.
byte_end: usizeByte position one past the word’s END in the buffer’s text.
caret_offset_chars: i32Signed chars from the buffer caret to the END of this word
(byte_end). Positive when the word ends to the RIGHT of
the caret, negative to the LEFT, zero when the caret sits
exactly at the word’s end. Emit uses this to compute
Right/Left arrows before deleting the word.
Trait Implementations§
Source§impl Clone for NearbyWord
impl Clone for NearbyWord
Source§fn clone(&self) -> NearbyWord
fn clone(&self) -> NearbyWord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NearbyWord
impl Debug for NearbyWord
Source§impl PartialEq for NearbyWord
impl PartialEq for NearbyWord
Source§fn eq(&self, other: &NearbyWord) -> bool
fn eq(&self, other: &NearbyWord) -> bool
self and other values to be equal, and is used by ==.impl Eq for NearbyWord
impl StructuralPartialEq for NearbyWord
Auto Trait Implementations§
impl Freeze for NearbyWord
impl RefUnwindSafe for NearbyWord
impl Send for NearbyWord
impl Sync for NearbyWord
impl Unpin for NearbyWord
impl UnsafeUnpin for NearbyWord
impl UnwindSafe for NearbyWord
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.