pub struct Range {
pub start: Position,
pub end: Position,
pub is_linewise: bool,
}Expand description
Text range for operator execution.
Represents a contiguous range of text in a buffer. Used by operators to know which text to act on.
The is_linewise flag indicates whether the range should be treated
as spanning complete lines (e.g., yj, dd) or character positions
(e.g., yw, d$).
Fields§
§start: PositionStart position (inclusive).
end: PositionEnd position (exclusive).
is_linewise: boolWhether this range represents linewise selection.
Linewise ranges affect paste behavior:
true: Paste inserts on new lines (above/below)false: Paste inserts inline at cursor
Implementations§
Source§impl Range
impl Range
Sourcepub const fn new(start: Position, end: Position) -> Self
pub const fn new(start: Position, end: Position) -> Self
Create a new characterwise range (default).
Sourcepub const fn from_position(pos: Position) -> Self
pub const fn from_position(pos: Position) -> Self
Create a range from a single position (zero-width, characterwise).
Sourcepub const fn to_linewise(self) -> Self
pub const fn to_linewise(self) -> Self
Convert this range to linewise.
Sourcepub const fn is_single_line(&self) -> bool
pub const fn is_single_line(&self) -> bool
Check if this is a single-line range.
Sourcepub const fn line_count(&self) -> usize
pub const fn line_count(&self) -> usize
Get the number of lines spanned.
Sourcepub fn normalized(self) -> Self
pub fn normalized(self) -> Self
Normalize the range so start <= end.
Trait Implementations§
impl Copy for Range
impl Eq for Range
impl StructuralPartialEq for Range
Auto Trait Implementations§
impl Freeze for Range
impl RefUnwindSafe for Range
impl Send for Range
impl Sync for Range
impl Unpin for Range
impl UnsafeUnpin for Range
impl UnwindSafe for Range
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
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
Compare self to
key and return true if they are equal.