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