Struct modalkit::editing::store::Store

source ·
pub struct Store<I: ApplicationInfo> {
    pub buffers: BufferStore<I>,
    pub completions: CompletionStore,
    pub digraphs: DigraphStore,
    pub registers: RegisterStore,
    pub cursors: CursorStore<I>,
    pub commands: HistoryList<EditRope>,
    pub searches: HistoryList<EditRope>,
    pub application: I::Store,
}
Expand description

Global editing context

Fields§

§buffers: BufferStore<I>

Tracks what buffers have been created.

§completions: CompletionStore

Tracks information used for text completions.

§digraphs: DigraphStore

Tracks mapped digraphs.

§registers: RegisterStore

Tracks the current value of each Register.

§cursors: CursorStore<I>

Tracks globally-relevant cursors and cursor groups.

§commands: HistoryList<EditRope>

Tracks previous commands.

§searches: HistoryList<EditRope>

Tracks previous search expressions.

§application: I::Store

Application-specific storage.

Implementations§

source§

impl<I> Store<I>
where I: ApplicationInfo,

source

pub fn new(application: I::Store) -> Self

Create a new Store using an already initialized application store.

source

pub fn shared(self) -> SharedStore<I>

Wrap this store so that it can be shared between threads.

source

pub fn load_buffer(&mut self, id: I::ContentId) -> SharedBuffer<I>

Get a buffer via its identifier.

source

pub fn set_aborted_cmd<T: Into<EditRope>>(&mut self, text: T)

Add a command to the command history after the prompt has been aborted.

This will not update Register::LastCommand.

Add a search query to the search history after the prompt has been aborted.

This will not update Register::LastSearch.

source

pub fn set_last_cmd<T: Into<EditRope>>(&mut self, text: T)

Add a command to the command history, and set Register::LastCommand.

Add a search query to the search history, and set Register::LastSearch.

Trait Implementations§

source§

impl<I> Default for Store<I>

source§

fn default() -> Self

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

impl<'a, I> Editable<(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), Store<I>, I> for SharedBuffer<I>
where I: ApplicationInfo,

source§

fn editor_command( &mut self, act: &EditorAction, ctx: &(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), store: &mut Store<I> ) -> EditResult<EditInfo, I>

Execute an editor action.
source§

impl<'a, I> Editable<(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), Store<I>, I> for EditBuffer<I>
where I: ApplicationInfo,

source§

fn editor_command( &mut self, act: &EditorAction, ctx: &(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), store: &mut Store<I> ) -> EditResult<EditInfo, I>

Execute an editor action.
source§

impl<'a, I> EditorActions<(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), Store<I>, I> for EditBuffer<I>
where I: ApplicationInfo,

source§

fn edit( &mut self, action: &EditAction, target: &EditTarget, ictx: &(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), store: &mut Store<I> ) -> EditResult<EditInfo, I>

Perform an editing operation over the targeted text.
source§

fn mark( &mut self, name: Mark, ctx: &(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), store: &mut Store<I> ) -> EditResult<EditInfo, I>

Create or update a cursor mark based on the leader’s cursor position.
source§

fn complete( &mut self, comptype: &CompletionType, selection: &CompletionSelection, display: &CompletionDisplay, ctx: &(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), store: &mut Store<I> ) -> EditResult<EditInfo, I>

Complete the text before the cursor group leader.
source§

fn insert_text( &mut self, act: &InsertTextAction, ctx: &(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), store: &mut Store<I> ) -> EditResult<EditInfo, I>

Insert text relative to the current cursor position.
source§

fn selection_command( &mut self, act: &SelectionAction, ctx: &(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), store: &mut Store<I> ) -> EditResult<EditInfo, I>

Modify the current selection.
source§

fn cursor_command( &mut self, act: &CursorAction, ctx: &(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), store: &mut Store<I> ) -> EditResult<EditInfo, I>

Perform an action over a cursor group.
source§

fn history_command( &mut self, act: &HistoryAction, ctx: &(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), store: &mut Store<I> ) -> EditResult<EditInfo, I>

Move to a different point in the buffer’s editing history.
source§

impl<'a, I> Searchable<(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), Store<I>, I> for SharedBuffer<I>
where I: ApplicationInfo,

source§

fn search( &mut self, dir: MoveDirMod, count: Count, ctx: &(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), store: &mut Store<I> ) -> UIResult<EditInfo, I>

Search for the nth result in MoveDirMod direction.
source§

impl<'a, I> Searchable<(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), Store<I>, I> for EditBuffer<I>
where I: ApplicationInfo,

source§

fn search( &mut self, dir: MoveDirMod, count: Count, ctx: &(CursorGroupId, &'a ViewportContext<Cursor>, &'a EditContext), store: &mut Store<I> ) -> UIResult<EditInfo, I>

Search for the nth result in MoveDirMod direction.

Auto Trait Implementations§

§

impl<I> !Freeze for Store<I>

§

impl<I> !RefUnwindSafe for Store<I>

§

impl<I> Send for Store<I>

§

impl<I> !Sync for Store<I>

§

impl<I> Unpin for Store<I>

§

impl<I> !UnwindSafe for Store<I>

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> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<T> Any for T
where T: Any,