pub struct TextObjectEngine;Expand description
Text object calculation engine.
Provides pure calculations for text object ranges without modifying any state.
§Example
use reovim_kernel::api::v1::*;
let buffer = Buffer::from_string("hello world");
let pos = Position::new(0, 0);
let range = TextObjectEngine::range(
&buffer,
pos,
TextObject::InnerWord(WordBoundary::Word),
1,
);
assert_eq!(range, Some((Position::new(0, 0), Position::new(0, 4))));Implementations§
Source§impl TextObjectEngine
impl TextObjectEngine
Sourcepub fn range(
buffer: &Buffer,
position: Position,
text_object: TextObject,
count: usize,
) -> Option<(Position, Position)>
pub fn range( buffer: &Buffer, position: Position, text_object: TextObject, count: usize, ) -> Option<(Position, Position)>
Calculate the range for a text object.
Returns (start, end) positions for the text object, where both
positions are inclusive.
§Arguments
buffer- The buffer to calculate inposition- Current cursor positiontext_object- The text object to calculatecount- Number of text objects (for nested brackets, etc.)
§Returns
Some((start, end)) if a valid range was found, None otherwise.
Auto Trait Implementations§
impl Freeze for TextObjectEngine
impl RefUnwindSafe for TextObjectEngine
impl Send for TextObjectEngine
impl Sync for TextObjectEngine
impl Unpin for TextObjectEngine
impl UnsafeUnpin for TextObjectEngine
impl UnwindSafe for TextObjectEngine
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