modehandler

package
v0.1.0-pre-release-v3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 11 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
	ModeCommand
	ModeFind
)

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

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

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

Jump to

Keyboard shortcuts

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