Skip to main content

Action

Enum Action 

Source
pub enum Action {
Show 38 variants Quit(bool), Save, SaveAs(String), Undo, UndoMultiple(Vec<Action>), CenterView, MoveUp, MoveDown, MoveLeft, MoveRight, MoveTo(usize, usize), MoveToTop, MoveToBottom, MoveToLineEnd, MoveToLineStart, MoveLineToViewCenter, MoveLineToViewBottom, MoveViewDownOneLine, MoveViewUpOneLine, MoveToBottomOfBuffer, MoveToTopOfBuffer, PageUp, PageDown, Command(String), InsertCharAtCursor(char), RemoveCharAt(usize, usize), InsertLineAbove, InsertLineBelow, InsertLineAt(usize, Option<String>), InsertNewLine, ReplaceLineAt(usize, String), DeletePreviousChar, DeleteCharAtCursor, DeleteCurrentLine, DeleteLineAt(usize), GoToLine(usize), EnterMode(Mode), SetWaitingKey(Box<KeyAction>),
}
Expand description

The collection of handled editor actions

This is primarily leveraged by the main editor processing loop for mapping user input sequences to handleable actions

Variants§

§

Quit(bool)

Closes the application

§

Save

Writes the current buffer to a file

§

SaveAs(String)

Writes the current buffer to the file provided as an argument to the ‘:w’ command

§

Undo

Reverses the previous undoable action

§

UndoMultiple(Vec<Action>)

Reverses multiple previous undoable actions simultaneously

§

CenterView

Moves the current line to the center of the view

§

MoveUp

Move the cursor up

§

MoveDown

Move the cursor down

§

MoveLeft

Move the cursor left

§

MoveRight

Move the cursor right

§

MoveTo(usize, usize)

Move to a specific (x, y) position in the buffer

§

MoveToTop

Move the cursor to the top of the buffer

§

MoveToBottom

Move the cursor to the bottom of the buffer

§

MoveToLineEnd

Move the cursor to the end of the current line

§

MoveToLineStart

Move the cursor to the beginning of the current line

§

MoveLineToViewCenter

Move the current line to the center of the view

§

MoveLineToViewBottom

Move the current line to the bottom of the view

§

MoveViewDownOneLine

Move the viewport down one line

§

MoveViewUpOneLine

Move the viewport up one line

§

MoveToBottomOfBuffer

Move the cursor to the bottom of the buffer

§

MoveToTopOfBuffer

Move the cursor to the top of the buffer

§

PageUp

Move the view up one “page”

§

PageDown

Move the view down one “page”

§

Command(String)

Run a command given a string input in command mode

§

InsertCharAtCursor(char)

Insert a character at the current location of the cursor

§

RemoveCharAt(usize, usize)

Remove a character at the specified position

§

InsertLineAbove

Insert a line above the cursor

§

InsertLineBelow

Insert a line below the cursor

§

InsertLineAt(usize, Option<String>)

Insert a line at the specified y coordinate

§

InsertNewLine

Insert a new line character (‘\n’)

§

ReplaceLineAt(usize, String)

Replace the contents of the line at the specified y coordinate with another string

§

DeletePreviousChar

Delete the character behind the cursor

§

DeleteCharAtCursor

Delete the character at the cursor

§

DeleteCurrentLine

Delete the line where the cursor is currently located

§

DeleteLineAt(usize)

Delete the line at the specified y coordinate

§

GoToLine(usize)

Go to the specified line provided in command mode

§

EnterMode(Mode)

Change to mode

§

SetWaitingKey(Box<KeyAction>)

Store the first key in a multi-character command sequence

Trait Implementations§

Source§

impl Clone for Action

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Action

Source§

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

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

impl<'de> Deserialize<'de> for Action

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Action

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.