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§

source

fn first_word( &self, cursor: &Cursor, ctx: &CursorMovementsContext<'_, Cursor> ) -> Cursor

Calculate the position of the first word on the line of the provided cursor.

source

fn movement( &self, cursor: &Cursor, movement: &MoveType, count: &Count, ctx: &CursorMovementsContext<'_, Cursor> ) -> Option<Cursor>

Calculate the position of the cursor after performing a movement.

source

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.

source

fn range( &self, cursor: &Cursor, range: &RangeType, inclusive: bool, count: &Count, ctx: &CursorMovementsContext<'_, Cursor> ) -> Option<EditRange<Cursor>>

Calculate a cursor range based on a given cursor position and a RangeType.

Implementors§