Documentation
¶
Overview ¶
internal/input/action.go
internal/input/keymap.go
Index ¶
Constants ¶
const DefaultLeaderKey = ',' // Using comma as leader key
DefaultLeaderKey is the default key used to initiate sequences.
const LeaderTimeout = 500 * time.Millisecond
LeaderTimeout is the duration to wait for the second key in a sequence.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action int
Action represents a command or operation to be performed by the editor.
const ( // --- Meta Actions --- ActionUnknown Action = iota // Default/invalid action ActionQuit ActionForceQuit // Quit without checking modified status ActionSave // --- Cursor Movement --- ActionMoveUp ActionMoveDown ActionMoveLeft ActionMoveRight ActionMovePageUp ActionMovePageDown ActionMoveHome // Beginning of line ActionMoveEnd // End of line // --- Text Manipulation --- ActionInsertRune // Requires Rune argument ActionInsertNewLine // Specific action for Enter ActionInsertTab // Specific action for Tab key ActionDeleteCharForward // Delete key ActionDeleteCharBackward // Backspace key ActionYank // Copy selection to clipboard ActionPaste // Insert clipboard content ActionUndo // Undo last edit ActionRedo // Redo previously undone edit // --- Editor Mode --- ActionEnterCommandMode // Special action for ':' ActionExecuteCommand // Special action for Enter in Command Mode ActionCancelCommand // Special action for Esc in Command Mode ActionAppendCommand // Special action for runes in Command Mode ActionDeleteCommandChar // Special action for Backspace in Command Mode // --- find --- ActionEnterFindMode // Trigger find mode (e.g., '/') ActionFindNext // Find next occurrence (e.g., 'n') ActionFindPrevious // Find previous occurrence (e.g., 'N') )
Define the set of possible editor actions.
type ActionEvent ¶
ActionEvent represents a decoded input event resulting in an action. It might carry payload data needed for the action (like the rune to insert).
type InputProcessor ¶
type InputProcessor struct {
// contains filtered or unexported fields
}
InputProcessor translates tcell events into ActionEvents.
func NewInputProcessor ¶
func NewInputProcessor() *InputProcessor
NewInputProcessor creates a processor with default keybindings.
func (*InputProcessor) GetLeaderKey ¶
func (p *InputProcessor) GetLeaderKey() rune
GetLeaderKey returns the configured leader key rune.
func (*InputProcessor) IsLeaderSequenceKey ¶
func (p *InputProcessor) IsLeaderSequenceKey(r rune) (Action, bool)
IsLeaderSequenceKey checks if a rune completes a known leader sequence.
func (*InputProcessor) ProcessEvent ¶
func (p *InputProcessor) ProcessEvent(ev *tcell.EventKey) ActionEvent
ProcessEvent takes a tcell key event and returns the corresponding ActionEvent.
type Keymap ¶
Keymap maps specific key events to editor actions. We use a simple map for now. Could evolve to handle sequences/modes later.
type LeaderSequenceMap ¶
LeaderSequenceMap maps the key following the leader to an action