modehandler

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

internal/modehandler/modehandler.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Editor         *core.Editor
	InputProcessor *input.InputProcessor
	EventManager   *event.Manager
	StatusBar      *statusbar.StatusBar
	QuitSignal     chan<- struct{}
}

Config holds dependencies for the ModeHandler.

type InputMode

type InputMode int

InputMode defines the different states for user input.

const (
	ModeNormal InputMode = iota
	ModeInsert
	ModeCommand
	ModeFind
	ModeVisual
	ModeVisualLine // Line-wise visual mode (Vim 'V')
)

type ModeHandler

type ModeHandler struct {
	// contains filtered or unexported fields
}

ModeHandler manages input modes, command execution, and related state.

func New

func New(cfg Config) *ModeHandler

New creates and returns a new ModeHandler.

func (*ModeHandler) GetCommandBuffer

func (mh *ModeHandler) GetCommandBuffer() string

GetCommandBuffer returns the current command buffer content (e.g., for display).

func (*ModeHandler) GetCurrentMode

func (mh *ModeHandler) GetCurrentMode() InputMode

GetCurrentMode returns the current input mode.

func (*ModeHandler) GetCurrentModeString

func (mh *ModeHandler) GetCurrentModeString() string

GetCurrentModeString returns the current input mode as a user-friendly string.

func (*ModeHandler) GetFindBuffer

func (mh *ModeHandler) GetFindBuffer() string

GetFindBuffer returns the find buffer content.

func (*ModeHandler) HandleKeyEvent

func (mh *ModeHandler) HandleKeyEvent(ev *tcell.EventKey) bool

HandleKeyEvent decides what to do based on current mode and key event. Returns true if the event resulted in an action requiring redraw.

func (*ModeHandler) HandleMouseEvent added in v0.1.3

func (mh *ModeHandler) HandleMouseEvent(ev *tcell.EventMouse) bool

HandleMouseEvent processes mouse input events.

func (*ModeHandler) RegisterCommand

func (mh *ModeHandler) RegisterCommand(name string, cmdFunc plugin.CommandFunc) error

RegisterCommand adds a command to the registry. Called via EditorAPI.

func (*ModeHandler) SetAPI added in v0.1.3

func (mh *ModeHandler) SetAPI(api plugin.EditorAPI)

SetAPI stores a reference to the EditorAPI for use by command handlers.

func (*ModeHandler) SetEditor added in v0.1.3

func (mh *ModeHandler) SetEditor(e *core.Editor)

New creates a new ModeHandler. SetEditor updates the active editor

Jump to

Keyboard shortcuts

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