input

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
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(s *state.EditorState)
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 AppendRuneToMenuSearch(r rune) Action

func AppendRuneToSearchQuery

func AppendRuneToSearchQuery(r rune) Action

func AppendRuneToTextField added in v1.3.0

func AppendRuneToTextField(r rune) Action

func BracketedPasteIntoMenuSearch added in v1.0.0

func BracketedPasteIntoMenuSearch(text string) Action

func BracketedPasteIntoSearchQuery added in v1.0.0

func BracketedPasteIntoSearchQuery(text string) Action

func ChangeAWord

func ChangeAWord(count uint64, clipboardPage clipboard.PageId) Action

func ChangeAngleBlock added in v1.0.0

func ChangeAngleBlock(includeAngleBrackets bool, clipboardPage clipboard.PageId) Action

func ChangeBraceBlock added in v1.0.0

func ChangeBraceBlock(includeBraces bool, clipboardPage clipboard.PageId) Action

func ChangeInnerWord

func ChangeInnerWord(count uint64, clipboardPage clipboard.PageId) Action

func ChangeParenBlock added in v1.0.0

func ChangeParenBlock(includeParens bool, clipboardPage clipboard.PageId) Action

func ChangeSelection

func ChangeSelection(clipboardPage clipboard.PageId, selectionMode selection.Mode, selectionEndLoc state.Locator) Action

func ChangeStringObject added in v1.0.0

func ChangeStringObject(quoteRune rune, includeQuotes bool, clipboardPage clipboard.PageId) Action

func ChangeToNextMatchingChar added in v0.2.0

func ChangeToNextMatchingChar(char rune, count uint64, clipboardPage clipboard.PageId, includeChar bool) Action

func ChangeToPrevMatchingChar added in v0.2.0

func ChangeToPrevMatchingChar(char rune, count uint64, clipboardPage clipboard.PageId, includeChar bool) Action

func ChangeWord added in v0.6.0

func ChangeWord(count uint64, clipboardPage clipboard.PageId) Action

func CopyAWord added in v0.2.0

func CopyAWord(count uint64, clipboardPage clipboard.PageId) Action

func CopyInnerWord added in v0.2.0

func CopyInnerWord(count uint64, clipboardPage clipboard.PageId) Action

func CopyLines

func CopyLines(clipboardPage clipboard.PageId) Action

func CopySelectionAndReturnToNormalMode

func CopySelectionAndReturnToNormalMode(clipboardPage clipboard.PageId) Action

func CopyStringObject added in v1.0.0

func CopyStringObject(quoteRune rune, includeQuotes bool, clipboardPage clipboard.PageId) Action

func CopyToNextMatchingChar added in v1.1.0

func CopyToNextMatchingChar(char rune, count uint64, clipboardPage clipboard.PageId, includeChar bool) Action

func CopyToPrevMatchingChar added in v1.1.0

func CopyToPrevMatchingChar(char rune, count uint64, clipboardPage clipboard.PageId, includeChar bool) Action

func CopyToStartOfNextWord added in v0.2.0

func CopyToStartOfNextWord(count uint64, clipboardPage clipboard.PageId, withPunctuation bool) Action

func CursorBack

func CursorBack(count uint64) Action

func CursorDown

func CursorDown(count uint64) Action

func CursorLeft

func CursorLeft(count uint64) Action

func CursorNextLine added in v1.0.0

func CursorNextLine(count uint64) Action

func CursorNextWordEnd

func CursorNextWordEnd(count uint64, withPunctuation bool) Action

func CursorNextWordStart

func CursorNextWordStart(count uint64, withPunctuation bool) Action

func CursorPrevWordStart

func CursorPrevWordStart(count uint64, withPunctuation bool) Action

func CursorRight

func CursorRight(count uint64) Action

func CursorStartOfLineNum

func CursorStartOfLineNum(count uint64) Action

func CursorToNextMatchingChar added in v0.2.0

func CursorToNextMatchingChar(char rune, count uint64, includeChar bool) Action

func CursorToPrevMatchingChar added in v0.2.0

func CursorToPrevMatchingChar(char rune, count uint64, includeChar bool) Action

func CursorUp

func CursorUp(count uint64) Action

func DeleteAWord

func DeleteAWord(count uint64, clipboardPage clipboard.PageId) Action

func DeleteAngleBlock added in v1.0.0

func DeleteAngleBlock(includeAngleBrackets bool, clipboardPage clipboard.PageId) Action

func DeleteBraceBlock added in v1.0.0

func DeleteBraceBlock(includeBraces bool, clipboardPage clipboard.PageId) Action

func DeleteDown

func DeleteDown(clipboardPage clipboard.PageId) Action

func DeleteInnerWord

func DeleteInnerWord(count uint64, clipboardPage clipboard.PageId) Action

func DeleteLines added in v0.2.0

func DeleteLines(count uint64, clipboardPage clipboard.PageId) Action

func DeleteNextCharInLine

func DeleteNextCharInLine(count uint64, clipboardPage clipboard.PageId) Action

func DeleteParenBlock added in v1.0.0

func DeleteParenBlock(includeParens bool, clipboardPage clipboard.PageId) Action

func DeletePrevChar

func DeletePrevChar(clipboardPage clipboard.PageId) Action

func DeletePrevCharInLine

func DeletePrevCharInLine(clipboardPage clipboard.PageId) Action

func DeleteSelection added in v0.2.0

func DeleteSelection(clipboardPage clipboard.PageId, selectionMode selection.Mode, selectionEndLoc state.Locator, replaceWithEmptyLine bool) Action

func DeleteSelectionAndReturnToNormalMode

func DeleteSelectionAndReturnToNormalMode(clipboardPage clipboard.PageId, selectionMode selection.Mode, selectionEndLoc state.Locator) Action

func DeleteStringObject added in v1.0.0

func DeleteStringObject(quoteRune rune, includeQuotes bool, clipboardPage clipboard.PageId) Action

func DeleteToEndOfLine

func DeleteToEndOfLine(clipboardPage clipboard.PageId) Action

func DeleteToNextMatchingChar added in v0.2.0

func DeleteToNextMatchingChar(char rune, count uint64, clipboardPage clipboard.PageId, includeChar bool) Action

func DeleteToPrevMatchingChar added in v0.2.0

func DeleteToPrevMatchingChar(char rune, count uint64, clipboardPage clipboard.PageId, includeChar bool) Action

func DeleteToStartOfLine

func DeleteToStartOfLine(clipboardPage clipboard.PageId) Action

func DeleteToStartOfLineNonWhitespace

func DeleteToStartOfLineNonWhitespace(clipboardPage clipboard.PageId) Action

func DeleteToStartOfNextWord added in v0.2.0

func DeleteToStartOfNextWord(count uint64, clipboardPage clipboard.PageId, withPunctuation bool) Action

func DeleteUp

func DeleteUp(clipboardPage clipboard.PageId) Action

func IndentLine

func IndentLine(count uint64) Action

func IndentSelectionAndReturnToNormalMode

func IndentSelectionAndReturnToNormalMode(selectionEndLoc state.Locator, count uint64) Action

func InsertFromBracketedPaste added in v1.0.0

func InsertFromBracketedPaste(text string) Action

func InsertRune

func InsertRune(r rune) Action

func OutdentLine

func OutdentLine(count uint64) Action

func OutdentSelectionAndReturnToNormalMode

func OutdentSelectionAndReturnToNormalMode(selectionEndLoc state.Locator, count uint64) Action

func PasteAfterCursor

func PasteAfterCursor(clipboardPage clipboard.PageId) Action

func PasteBeforeCursor

func PasteBeforeCursor(clipboardPage clipboard.PageId) Action

func ReplaceCharacter

func ReplaceCharacter(newChar rune) Action

func ReplayLastActionMacro added in v0.3.0

func ReplayLastActionMacro(count uint64) Action

func ScrollDown

func ScrollDown(ctx Context, half bool) Action

func ScrollUp

func ScrollUp(ctx Context, half bool) Action

func SearchWordUnderCursor added in v0.7.0

func SearchWordUnderCursor(direction state.SearchDirection, count uint64) Action

func SelectAWord added in v1.0.0

func SelectAWord(count uint64) Action

func SelectAngleBlock added in v1.0.0

func SelectAngleBlock(includeAngleBrackets bool) Action

func SelectBraceBlock added in v1.0.0

func SelectBraceBlock(includeBraces bool) Action

func SelectInnerWord added in v1.0.0

func SelectInnerWord(count uint64) Action

func SelectParenBlock added in v1.0.0

func SelectParenBlock(includeParens bool) Action

func SelectStringObject added in v1.0.0

func SelectStringObject(quoteRune rune, includeQuotes bool) Action

func ShowCommandMenu

func ShowCommandMenu(ctx Context) Action

func ShowFileMenu

func ShowFileMenu(ctx Context) Action

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

func ToggleCaseInSelectionAndReturnToNormalMode

func ToggleCaseInSelectionAndReturnToNormalMode(selectionEndLoc state.Locator) 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() []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 NewInterpreter

func NewInterpreter() *Interpreter

NewInterpreter creates a new interpreter.

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.)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL