Skip to main content

MarkBank

Struct MarkBank 

Source
pub struct MarkBank { /* private fields */ }
Expand description

Mark storage for all mark types.

Manages buffer-local marks, global marks, and special marks.

§Mark Types

  • Local marks ('a-'z): Stored per-buffer, only position is tracked
  • Global marks ('A-'Z): Stored globally, includes buffer ID
  • Special marks: Automatically maintained editor positions

§Example

use reovim_kernel::api::v1::*;

let mut marks = MarkBank::new();

// Set local mark
marks.set_local('a', Position::new(10, 0));

// Set global mark
let buffer_id = BufferId::new();
marks.set_global('A', Mark::new(Position::new(5, 0), buffer_id));

// Set special mark (usually done automatically)
marks.set_special(SpecialMark::LastJump, Mark::new(Position::new(0, 0), buffer_id));

Implementations§

Source§

impl MarkBank

Source

pub fn new() -> Self

Create a new empty mark bank.

Source

pub fn set_local(&mut self, name: char, position: Position) -> bool

Set a local mark (‘a’-‘z’).

Returns true if successful, false if the mark name is invalid.

Source

pub fn get_local(&self, name: char) -> Option<Position>

Get a local mark (‘a’-‘z’).

Returns None if the mark doesn’t exist or name is invalid.

Source

pub fn delete_local(&mut self, name: char) -> bool

Delete a local mark.

Returns true if the mark existed and was deleted.

Source

pub fn list_local(&self) -> Vec<(char, Position)>

List all local marks.

Source

pub fn set_global(&mut self, name: char, mark: Mark) -> bool

Set a global mark (‘A’-‘Z’).

Returns true if successful, false if the mark name is invalid.

Source

pub fn get_global(&self, name: char) -> Option<&Mark>

Get a global mark (‘A’-‘Z’).

Returns None if the mark doesn’t exist or name is invalid.

Source

pub fn delete_global(&mut self, name: char) -> bool

Delete a global mark.

Returns true if the mark existed and was deleted.

Source

pub fn list_global(&self) -> Vec<(char, &Mark)>

List all global marks.

Source

pub fn set_special(&mut self, mark: SpecialMark, value: Mark)

Set a special mark.

Source

pub fn get_special(&self, mark: SpecialMark) -> Option<&Mark>

Get a special mark.

Source

pub fn clear_special(&mut self, mark: SpecialMark)

Clear a special mark.

Source

pub fn get_by_char(&self, c: char) -> Option<MarkResult<'_>>

Get mark by character (local, global, or special shorthand).

  • 'a'-'z' - Local marks (returns None for position, needs buffer context)
  • 'A'-'Z' - Global marks
  • '\'' or '`' - Last jump
  • '.' - Last edit
  • '^' - Last insert
  • '<' - Visual start
  • '>' - Visual end
Source

pub fn clear_local(&mut self)

Clear all local marks (for when buffer is closed).

Source

pub fn clear_all(&mut self)

Clear all marks.

Trait Implementations§

Source§

impl Clone for MarkBank

Source§

fn clone(&self) -> MarkBank

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MarkBank

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MarkBank

Source§

fn default() -> MarkBank

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.