Documentation ¶
Index ¶
- Constants
- func AbortSearch(s *state.EditorState)
- func BeginNewLineAbove(s *state.EditorState)
- func BeginNewLineBelow(s *state.EditorState)
- func CompleteSearch(s *state.EditorState)
- func CursorLineEnd(s *state.EditorState)
- func CursorLineEndIncludeEndOfLineOrFile(s *state.EditorState)
- func CursorLineStart(s *state.EditorState)
- func CursorLineStartNonWhitespace(s *state.EditorState)
- func CursorMatchingCodeBlockDelimiter(s *state.EditorState)
- func CursorNextParagraph(s *state.EditorState)
- func CursorNextUnmatchedCloseBrace(s *state.EditorState)
- func CursorNextUnmatchedCloseParen(s *state.EditorState)
- func CursorPrevParagraph(s *state.EditorState)
- func CursorPrevUnmatchedOpenBrace(s *state.EditorState)
- func CursorPrevUnmatchedOpenParen(s *state.EditorState)
- func CursorRightIncludeEndOfLineOrFile(s *state.EditorState)
- func CursorStartOfLastLine(s *state.EditorState)
- func DeleteRuneFromMenuSearch(s *state.EditorState)
- func DeleteRuneFromSearchQuery(s *state.EditorState)
- func EmptyAction(s *state.EditorState)
- func EnterInsertMode(s *state.EditorState)
- func EnterInsertModeAtEndOfLine(s *state.EditorState)
- func EnterInsertModeAtNextPos(s *state.EditorState)
- func EnterInsertModeAtStartOfLine(s *state.EditorState)
- func ExecuteSelectedMenuItem(s *state.EditorState)
- func FindNextMatch(s *state.EditorState)
- func FindPrevMatch(s *state.EditorState)
- func HideMenu(s *state.EditorState)
- func InsertNewlineAndUpdateAutoIndentWhitespace(s *state.EditorState)
- func InsertTab(s *state.EditorState)
- func JoinLines(s *state.EditorState)
- func MenuSelectionDown(s *state.EditorState)
- func MenuSelectionUp(s *state.EditorState)
- func Redo(s *state.EditorState)
- func ReturnToNormalMode(s *state.EditorState)
- func ReturnToNormalModeAfterInsert(s *state.EditorState)
- func ShowMoveOrRenameDocumentTextField(s *state.EditorState)
- func ShowNewDocumentTextField(s *state.EditorState)
- func ShowStatusMsgBracketedPasteWrongMode(s *state.EditorState)
- func ToggleCaseAtCursor(s *state.EditorState)
- func ToggleVisualModeCharwise(s *state.EditorState)
- func ToggleVisualModeLinewise(s *state.EditorState)
- func Undo(s *state.EditorState)
- type Action
- func AppendRuneToMenuSearch(r rune) Action
- func AppendRuneToSearchQuery(r rune) Action
- func AppendRuneToTextField(r rune) Action
- func BracketedPasteIntoMenuSearch(text string) Action
- func BracketedPasteIntoSearchQuery(text string) Action
- func ChangeAWord(count uint64, clipboardPage clipboard.PageId) Action
- func ChangeAngleBlock(includeAngleBrackets bool, clipboardPage clipboard.PageId) Action
- func ChangeBraceBlock(includeBraces bool, clipboardPage clipboard.PageId) Action
- func ChangeInnerWord(count uint64, clipboardPage clipboard.PageId) Action
- func ChangeParenBlock(includeParens bool, clipboardPage clipboard.PageId) Action
- func ChangeSelection(clipboardPage clipboard.PageId, selectionMode selection.Mode, ...) Action
- func ChangeStringObject(quoteRune rune, includeQuotes bool, clipboardPage clipboard.PageId) Action
- func ChangeToNextMatchingChar(char rune, count uint64, clipboardPage clipboard.PageId, includeChar bool) Action
- func ChangeToPrevMatchingChar(char rune, count uint64, clipboardPage clipboard.PageId, includeChar bool) Action
- func ChangeWord(count uint64, clipboardPage clipboard.PageId) Action
- func CopyAWord(count uint64, clipboardPage clipboard.PageId) Action
- func CopyInnerWord(count uint64, clipboardPage clipboard.PageId) Action
- func CopyLines(clipboardPage clipboard.PageId) Action
- func CopySelectionAndReturnToNormalMode(clipboardPage clipboard.PageId) Action
- func CopyStringObject(quoteRune rune, includeQuotes bool, clipboardPage clipboard.PageId) Action
- func CopyToNextMatchingChar(char rune, count uint64, clipboardPage clipboard.PageId, includeChar bool) Action
- func CopyToPrevMatchingChar(char rune, count uint64, clipboardPage clipboard.PageId, includeChar bool) Action
- func CopyToStartOfNextWord(count uint64, clipboardPage clipboard.PageId, withPunctuation bool) Action
- func CursorBack(count uint64) Action
- func CursorDown(count uint64) Action
- func CursorLeft(count uint64) Action
- func CursorNextLine(count uint64) Action
- func CursorNextWordEnd(count uint64, withPunctuation bool) Action
- func CursorNextWordStart(count uint64, withPunctuation bool) Action
- func CursorPrevWordStart(count uint64, withPunctuation bool) Action
- func CursorRight(count uint64) Action
- func CursorStartOfLineNum(count uint64) Action
- func CursorToNextMatchingChar(char rune, count uint64, includeChar bool) Action
- func CursorToPrevMatchingChar(char rune, count uint64, includeChar bool) Action
- func CursorUp(count uint64) Action
- func DeleteAWord(count uint64, clipboardPage clipboard.PageId) Action
- func DeleteAngleBlock(includeAngleBrackets bool, clipboardPage clipboard.PageId) Action
- func DeleteBraceBlock(includeBraces bool, clipboardPage clipboard.PageId) Action
- func DeleteDown(clipboardPage clipboard.PageId) Action
- func DeleteInnerWord(count uint64, clipboardPage clipboard.PageId) Action
- func DeleteLines(count uint64, clipboardPage clipboard.PageId) Action
- func DeleteNextCharInLine(count uint64, clipboardPage clipboard.PageId) Action
- func DeleteParenBlock(includeParens bool, clipboardPage clipboard.PageId) Action
- func DeletePrevChar(clipboardPage clipboard.PageId) Action
- func DeletePrevCharInLine(clipboardPage clipboard.PageId) Action
- func DeleteSelection(clipboardPage clipboard.PageId, selectionMode selection.Mode, ...) Action
- func DeleteSelectionAndReturnToNormalMode(clipboardPage clipboard.PageId, selectionMode selection.Mode, ...) Action
- func DeleteStringObject(quoteRune rune, includeQuotes bool, clipboardPage clipboard.PageId) Action
- func DeleteToEndOfLine(clipboardPage clipboard.PageId) Action
- func DeleteToNextMatchingChar(char rune, count uint64, clipboardPage clipboard.PageId, includeChar bool) Action
- func DeleteToPrevMatchingChar(char rune, count uint64, clipboardPage clipboard.PageId, includeChar bool) Action
- func DeleteToStartOfLine(clipboardPage clipboard.PageId) Action
- func DeleteToStartOfLineNonWhitespace(clipboardPage clipboard.PageId) Action
- func DeleteToStartOfNextWord(count uint64, clipboardPage clipboard.PageId, withPunctuation bool) Action
- func DeleteUp(clipboardPage clipboard.PageId) Action
- func IndentLine(count uint64) Action
- func IndentSelectionAndReturnToNormalMode(selectionEndLoc state.Locator, count uint64) Action
- func InsertFromBracketedPaste(text string) Action
- func InsertRune(r rune) Action
- func OutdentLine(count uint64) Action
- func OutdentSelectionAndReturnToNormalMode(selectionEndLoc state.Locator, count uint64) Action
- func PasteAfterCursor(clipboardPage clipboard.PageId) Action
- func PasteBeforeCursor(clipboardPage clipboard.PageId) Action
- func ReplaceCharacter(newChar rune) Action
- func ReplayLastActionMacro(count uint64) Action
- func ScrollDown(ctx Context, half bool) Action
- func ScrollUp(ctx Context, half bool) Action
- func SearchWordUnderCursor(direction state.SearchDirection, count uint64) Action
- func SelectAWord(count uint64) Action
- func SelectAngleBlock(includeAngleBrackets bool) Action
- func SelectBraceBlock(includeBraces bool) Action
- func SelectInnerWord(count uint64) Action
- func SelectParenBlock(includeParens bool) Action
- func SelectStringObject(quoteRune rune, includeQuotes bool) Action
- func ShowCommandMenu(ctx Context) Action
- func ShowFileMenu(ctx Context) Action
- func StartSearch(direction state.SearchDirection) Action
- func StartSearchForChange(direction state.SearchDirection, clipboardPage clipboard.PageId) Action
- func StartSearchForCopy(direction state.SearchDirection, clipboardPage clipboard.PageId) Action
- func StartSearchForDelete(direction state.SearchDirection, clipboardPage clipboard.PageId) Action
- func ToggleCaseInSelectionAndReturnToNormalMode(selectionEndLoc state.Locator) Action
- type Command
- type CommandParams
- type Context
- type Interpreter
Constants ¶
const ( NormalModePath = "generated/normal.bin" InsertModePath = "generated/insert.bin" VisualModePath = "generated/visual.bin" MenuModePath = "generated/menu.bin" SearchModePath = "generated/search.bin" TaskModePath = "generated/task.bin" TextFieldModePath = "generated/textfield.bin" )
Variables ¶
This section is empty.
Functions ¶
func AbortSearch ¶ added in v1.3.0
func AbortSearch(s *state.EditorState)
func BeginNewLineAbove ¶
func BeginNewLineAbove(s *state.EditorState)
func BeginNewLineBelow ¶
func BeginNewLineBelow(s *state.EditorState)
func CompleteSearch ¶ added in v1.1.0
func CompleteSearch(s *state.EditorState)
func CursorLineEnd ¶
func CursorLineEnd(s *state.EditorState)
func CursorLineEndIncludeEndOfLineOrFile ¶
func CursorLineEndIncludeEndOfLineOrFile(s *state.EditorState)
func CursorLineStart ¶
func CursorLineStart(s *state.EditorState)
func CursorLineStartNonWhitespace ¶
func CursorLineStartNonWhitespace(s *state.EditorState)
func CursorMatchingCodeBlockDelimiter ¶ added in v0.7.0
func CursorMatchingCodeBlockDelimiter(s *state.EditorState)
func CursorNextParagraph ¶
func CursorNextParagraph(s *state.EditorState)
func CursorNextUnmatchedCloseBrace ¶ added in v0.7.0
func CursorNextUnmatchedCloseBrace(s *state.EditorState)
func CursorNextUnmatchedCloseParen ¶ added in v0.7.0
func CursorNextUnmatchedCloseParen(s *state.EditorState)
func CursorPrevParagraph ¶
func CursorPrevParagraph(s *state.EditorState)
func CursorPrevUnmatchedOpenBrace ¶ added in v0.7.0
func CursorPrevUnmatchedOpenBrace(s *state.EditorState)
func CursorPrevUnmatchedOpenParen ¶ added in v0.7.0
func CursorPrevUnmatchedOpenParen(s *state.EditorState)
func CursorRightIncludeEndOfLineOrFile ¶
func CursorRightIncludeEndOfLineOrFile(s *state.EditorState)
func CursorStartOfLastLine ¶
func CursorStartOfLastLine(s *state.EditorState)
func DeleteRuneFromMenuSearch ¶
func DeleteRuneFromMenuSearch(s *state.EditorState)
func DeleteRuneFromSearchQuery ¶
func DeleteRuneFromSearchQuery(s *state.EditorState)
func EmptyAction ¶
func EmptyAction(s *state.EditorState)
EmptyAction is an action that does nothing.
func EnterInsertMode ¶
func EnterInsertMode(s *state.EditorState)
func EnterInsertModeAtEndOfLine ¶
func EnterInsertModeAtEndOfLine(s *state.EditorState)
func EnterInsertModeAtNextPos ¶
func EnterInsertModeAtNextPos(s *state.EditorState)
func EnterInsertModeAtStartOfLine ¶
func EnterInsertModeAtStartOfLine(s *state.EditorState)
func ExecuteSelectedMenuItem ¶
func ExecuteSelectedMenuItem(s *state.EditorState)
func FindNextMatch ¶
func FindNextMatch(s *state.EditorState)
func FindPrevMatch ¶
func FindPrevMatch(s *state.EditorState)
func HideMenu ¶ added in v1.3.0
func HideMenu(s *state.EditorState)
func InsertNewlineAndUpdateAutoIndentWhitespace ¶ added in v0.2.0
func InsertNewlineAndUpdateAutoIndentWhitespace(s *state.EditorState)
func InsertTab ¶
func InsertTab(s *state.EditorState)
func JoinLines ¶
func JoinLines(s *state.EditorState)
func MenuSelectionDown ¶
func MenuSelectionDown(s *state.EditorState)
func MenuSelectionUp ¶
func MenuSelectionUp(s *state.EditorState)
func Redo ¶
func Redo(s *state.EditorState)
func ReturnToNormalMode ¶
func ReturnToNormalMode(s *state.EditorState)
func ReturnToNormalModeAfterInsert ¶ added in v0.2.0
func ReturnToNormalModeAfterInsert(s *state.EditorState)
func ShowMoveOrRenameDocumentTextField ¶ added in v1.3.0
func ShowMoveOrRenameDocumentTextField(s *state.EditorState)
func ShowNewDocumentTextField ¶ added in v1.3.0
func ShowNewDocumentTextField(s *state.EditorState)
func ShowStatusMsgBracketedPasteWrongMode ¶ added in v1.0.0
func ShowStatusMsgBracketedPasteWrongMode(s *state.EditorState)
func ToggleCaseAtCursor ¶
func ToggleCaseAtCursor(s *state.EditorState)
func ToggleVisualModeCharwise ¶
func ToggleVisualModeCharwise(s *state.EditorState)
func ToggleVisualModeLinewise ¶
func ToggleVisualModeLinewise(s *state.EditorState)
func Undo ¶
func Undo(s *state.EditorState)
Types ¶
type Action ¶
type Action func(*state.EditorState)
Action is a function that mutates the editor state.
func AppendRuneToMenuSearch ¶
func AppendRuneToSearchQuery ¶
func AppendRuneToTextField ¶ added in v1.3.0
func BracketedPasteIntoMenuSearch ¶ added in v1.0.0
func BracketedPasteIntoSearchQuery ¶ added in v1.0.0
func ChangeAngleBlock ¶ added in v1.0.0
func ChangeBraceBlock ¶ added in v1.0.0
func ChangeParenBlock ¶ added in v1.0.0
func ChangeSelection ¶
func ChangeStringObject ¶ added in v1.0.0
func ChangeToNextMatchingChar ¶ added in v0.2.0
func ChangeToPrevMatchingChar ¶ added in v0.2.0
func ChangeWord ¶ added in v0.6.0
func CopyInnerWord ¶ added in v0.2.0
func CopyStringObject ¶ added in v1.0.0
func CopyToNextMatchingChar ¶ added in v1.1.0
func CopyToPrevMatchingChar ¶ added in v1.1.0
func CopyToStartOfNextWord ¶ added in v0.2.0
func CursorBack ¶
func CursorDown ¶
func CursorLeft ¶
func CursorNextLine ¶ added in v1.0.0
func CursorNextWordEnd ¶
func CursorNextWordStart ¶
func CursorPrevWordStart ¶
func CursorRight ¶
func CursorStartOfLineNum ¶
func CursorToNextMatchingChar ¶ added in v0.2.0
func CursorToPrevMatchingChar ¶ added in v0.2.0
func DeleteAngleBlock ¶ added in v1.0.0
func DeleteBraceBlock ¶ added in v1.0.0
func DeleteDown ¶
func DeleteLines ¶ added in v0.2.0
func DeleteNextCharInLine ¶
func DeleteParenBlock ¶ added in v1.0.0
func DeletePrevChar ¶
func DeletePrevCharInLine ¶
func DeleteSelection ¶ added in v0.2.0
func DeleteStringObject ¶ added in v1.0.0
func DeleteToEndOfLine ¶
func DeleteToNextMatchingChar ¶ added in v0.2.0
func DeleteToPrevMatchingChar ¶ added in v0.2.0
func DeleteToStartOfLine ¶
func DeleteToStartOfNextWord ¶ added in v0.2.0
func IndentLine ¶
func InsertFromBracketedPaste ¶ added in v1.0.0
func InsertRune ¶
func OutdentLine ¶
func PasteAfterCursor ¶
func PasteBeforeCursor ¶
func ReplaceCharacter ¶
func ReplayLastActionMacro ¶ added in v0.3.0
func ScrollDown ¶
func SearchWordUnderCursor ¶ added in v0.7.0
func SearchWordUnderCursor(direction state.SearchDirection, count uint64) Action
func SelectAWord ¶ added in v1.0.0
func SelectAngleBlock ¶ added in v1.0.0
func SelectBraceBlock ¶ added in v1.0.0
func SelectInnerWord ¶ added in v1.0.0
func SelectParenBlock ¶ added in v1.0.0
func SelectStringObject ¶ added in v1.0.0
func ShowCommandMenu ¶
func ShowFileMenu ¶
func StartSearch ¶ added in v1.1.0
func StartSearch(direction state.SearchDirection) Action
func StartSearchForChange ¶ added in v1.1.0
func StartSearchForChange(direction state.SearchDirection, clipboardPage clipboard.PageId) Action
func StartSearchForCopy ¶ added in v1.1.0
func StartSearchForCopy(direction state.SearchDirection, clipboardPage clipboard.PageId) Action
func StartSearchForDelete ¶ added in v1.1.0
func StartSearchForDelete(direction state.SearchDirection, clipboardPage clipboard.PageId) Action
type Command ¶ added in v0.5.0
type Command struct { Name string BuildExpr func() engine.Expr MaxCount uint64 // Zero means no limit. BuildAction func(Context, CommandParams) Action }
Command defines a command that the input parser can recognize. The expression defines how the input processor recognizes the command, and the action defines how the editor executes the command.
func InsertModeCommands ¶ added in v0.6.0
func InsertModeCommands() []Command
func MenuModeCommands ¶ added in v0.6.0
func MenuModeCommands() []Command
func NormalModeCommands ¶ added in v0.6.0
func NormalModeCommands() []Command
func SearchModeCommands ¶ added in v0.6.0
func SearchModeCommands() []Command
func TaskModeCommands ¶ added in v0.6.0
func TaskModeCommands() []Command
func TextFieldCommands ¶ added in v1.3.0
func TextFieldCommands() []Command
func VisualModeCommands ¶ added in v0.6.0
func VisualModeCommands() []Command
type CommandParams ¶ added in v0.6.0
type CommandParams struct { Count uint64 ClipboardPage clipboard.PageId MatchChar rune ReplaceChar rune InsertChar rune }
CommandParams are parameters parsed from user input.
type Context ¶ added in v0.6.0
type Context struct { // InputMode is the current input mode of the editor. InputMode state.InputMode // ScrollLines is the number of lines to scroll up or down with Ctrl-F / Ctrl-N. // Ctrl-U / Ctrl-D scroll for half of that amount. ScrollLines uint64 // Glob patterns for directories to hide from file search. DirPatternsToHide []string // Information about the current selection (visual mode). // If not in visual mode, the mode will be selection.ModeNone // and the end locator will be nil. SelectionMode selection.Mode SelectionEndLocator state.Locator }
Context influences how user input is interpreted.
func ContextFromEditorState ¶ added in v0.6.0
func ContextFromEditorState(editorState *state.EditorState) Context
type Interpreter ¶
type Interpreter struct {
// contains filtered or unexported fields
}
Interpreter translates key events to commands.
func (*Interpreter) InputBufferString ¶ added in v0.2.0
func (inp *Interpreter) InputBufferString(mode state.InputMode) string
InputBufferString returns a string describing buffered input events. It can be displayed to the user to help them understand the input state.
func (*Interpreter) ProcessEvent ¶
func (inp *Interpreter) ProcessEvent(event tcell.Event, ctx Context) Action
ProcessEvent interprets a terminal input event as an action. (If there is no action, then EmptyAction will be returned.)