Trait modalkit::prelude::CursorMovements
source · pub trait CursorMovements<Cursor> {
// Required methods
fn first_word(
&self,
cursor: &Cursor,
ctx: &CursorMovementsContext<'_, Cursor>
) -> Cursor;
fn movement(
&self,
cursor: &Cursor,
movement: &MoveType,
count: &Count,
ctx: &CursorMovementsContext<'_, Cursor>
) -> Option<Cursor>;
fn range_of_movement(
&self,
cursor: &Cursor,
movement: &MoveType,
count: &Count,
ctx: &CursorMovementsContext<'_, Cursor>
) -> Option<EditRange<Cursor>>;
fn range(
&self,
cursor: &Cursor,
range: &RangeType,
inclusive: bool,
count: &Count,
ctx: &CursorMovementsContext<'_, Cursor>
) -> Option<EditRange<Cursor>>;
}
Expand description
Trait for objects capable of calculating contextual offsets from a cursor.
Required Methods§
sourcefn first_word(
&self,
cursor: &Cursor,
ctx: &CursorMovementsContext<'_, Cursor>
) -> Cursor
fn first_word( &self, cursor: &Cursor, ctx: &CursorMovementsContext<'_, Cursor> ) -> Cursor
Calculate the position of the first word on the line of the provided cursor.
sourcefn movement(
&self,
cursor: &Cursor,
movement: &MoveType,
count: &Count,
ctx: &CursorMovementsContext<'_, Cursor>
) -> Option<Cursor>
fn movement( &self, cursor: &Cursor, movement: &MoveType, count: &Count, ctx: &CursorMovementsContext<'_, Cursor> ) -> Option<Cursor>
Calculate the position of the cursor after performing a movement.
sourcefn range_of_movement(
&self,
cursor: &Cursor,
movement: &MoveType,
count: &Count,
ctx: &CursorMovementsContext<'_, Cursor>
) -> Option<EditRange<Cursor>>
fn range_of_movement( &self, cursor: &Cursor, movement: &MoveType, count: &Count, ctx: &CursorMovementsContext<'_, Cursor> ) -> Option<EditRange<Cursor>>
Calculate a cursor range from the given cursor to the location after performing the given movement.