Documentation
¶
Index ¶
- func IsValidKey(key string) bool
- func NewHintFormatterFromRegistry(registry *Registry) *hints.Formatter
- type ContextCondition
- type HelpShortcut
- type KeyAction
- type KeyBindingManager
- func (m *KeyBindingManager) GetHelpShortcuts() []HelpShortcut
- func (m *KeyBindingManager) GetHintFormatter() *hints.Formatter
- func (m *KeyBindingManager) GetRegistry() KeyRegistry
- func (m *KeyBindingManager) IsKeyHandledByAction(keyMsg tea.KeyMsg) bool
- func (m *KeyBindingManager) ProcessKey(keyMsg tea.KeyMsg) tea.Cmd
- func (m *KeyBindingManager) RegisterCustomAction(action *KeyAction) error
- type KeyContext
- type KeyHandler
- type KeyHandlerContext
- type KeyLayer
- type KeyRegistry
- type LayerMatcher
- type Registry
- func (r *Registry) AddLayer(layer *KeyLayer)
- func (r *Registry) ApplyConfigOverrides(cfg config.KeybindingsConfig) error
- func (r *Registry) GetAction(id string) *KeyAction
- func (r *Registry) GetActiveActions(app KeyHandlerContext) []*KeyAction
- func (r *Registry) GetHelpShortcuts(app KeyHandlerContext) []HelpShortcut
- func (r *Registry) GetLayers() []*KeyLayer
- func (r *Registry) GetSequenceActionForPrefix(prefix string, app KeyHandlerContext) *KeyAction
- func (r *Registry) HasSequenceWithPrefix(prefix string, app KeyHandlerContext) bool
- func (r *Registry) ListAllActions() []*KeyAction
- func (r *Registry) Register(action *KeyAction) error
- func (r *Registry) Resolve(key string, app KeyHandlerContext) *KeyAction
- func (r *Registry) Unregister(id string) error
- type Theme
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidKey ¶ added in v0.77.0
IsValidKey checks if a key string is a known/valid key This is exposed for use in validation commands
func NewHintFormatterFromRegistry ¶ added in v0.77.0
NewHintFormatterFromRegistry creates a hints.Formatter from a keybinding Registry
Types ¶
type ContextCondition ¶
type ContextCondition struct {
Name string
Check func(app KeyHandlerContext) bool
}
ContextCondition represents a condition that must be met for key binding to be active
type HelpShortcut ¶
HelpShortcut represents a key shortcut for help display
type KeyAction ¶
type KeyAction struct {
ID string
Namespace config.KeyNamespace
Keys []string
Description string
Category string
Handler KeyHandler
Context KeyContext
Priority int
Enabled bool
}
KeyAction represents a key binding action with metadata
type KeyBindingManager ¶
type KeyBindingManager struct {
// contains filtered or unexported fields
}
KeyBindingManager manages the key binding system for ChatApplication
func NewKeyBindingManager ¶
func NewKeyBindingManager(app KeyHandlerContext, cfg *config.Config) *KeyBindingManager
NewKeyBindingManager creates a new key binding manager
func (*KeyBindingManager) GetHelpShortcuts ¶
func (m *KeyBindingManager) GetHelpShortcuts() []HelpShortcut
GetHelpShortcuts returns help shortcuts for the current context
func (*KeyBindingManager) GetHintFormatter ¶ added in v0.77.0
func (m *KeyBindingManager) GetHintFormatter() *hints.Formatter
GetHintFormatter returns a hint formatter for displaying keybinding hints in UI
func (*KeyBindingManager) GetRegistry ¶
func (m *KeyBindingManager) GetRegistry() KeyRegistry
GetRegistry returns the underlying registry (for advanced usage)
func (*KeyBindingManager) IsKeyHandledByAction ¶ added in v0.56.0
func (m *KeyBindingManager) IsKeyHandledByAction(keyMsg tea.KeyMsg) bool
IsKeyHandledByAction returns true if the key would be handled by a keybinding action
func (*KeyBindingManager) ProcessKey ¶
func (m *KeyBindingManager) ProcessKey(keyMsg tea.KeyMsg) tea.Cmd
ProcessKey handles key input and executes the appropriate action
func (*KeyBindingManager) RegisterCustomAction ¶
func (m *KeyBindingManager) RegisterCustomAction(action *KeyAction) error
RegisterCustomAction registers a new custom key action
type KeyContext ¶
type KeyContext struct {
Views []domain.ViewState
Conditions []ContextCondition
ExcludeViews []domain.ViewState
}
KeyContext defines when and where a key binding is active
type KeyHandler ¶
type KeyHandler func(app KeyHandlerContext, keyMsg tea.KeyMsg) tea.Cmd
KeyHandler represents a function that handles a key binding
type KeyHandlerContext ¶
type KeyHandlerContext interface {
// State management
GetStateManager() domain.StateManager
GetConversationRepository() domain.ConversationRepository
GetConfig() *config.Config
GetConfigDir() string
// Services
GetAgentService() domain.AgentService
GetImageService() domain.ImageService
// UI components
GetConversationView() ui.ConversationRenderer
GetInputView() ui.InputComponent
GetStatusView() ui.StatusComponent
GetAutocomplete() ui.AutocompleteComponent
// Actions
ToggleToolResultExpansion()
ToggleRawFormat()
SendMessage() tea.Cmd
GetPageSize() int
// Mouse mode
GetMouseEnabled() bool
SetMouseEnabled(bool)
}
KeyHandlerContext provides access to application context for key handlers
type KeyLayer ¶
type KeyLayer struct {
Name string
Priority int
Bindings map[string]*KeyAction
Matcher LayerMatcher
}
KeyLayer represents a layer of key bindings with specific priority
type KeyRegistry ¶
type KeyRegistry interface {
Register(action *KeyAction) error
Unregister(id string) error
Resolve(key string, app KeyHandlerContext) *KeyAction
GetAction(id string) *KeyAction
GetActiveActions(app KeyHandlerContext) []*KeyAction
GetHelpShortcuts(app KeyHandlerContext) []HelpShortcut
AddLayer(layer *KeyLayer)
GetLayers() []*KeyLayer
}
KeyRegistry manages all key bindings and their resolution
type LayerMatcher ¶
type LayerMatcher func(app KeyHandlerContext) bool
LayerMatcher determines if a layer is currently active
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry implements the KeyRegistry interface
func NewRegistry ¶
NewRegistry creates a new key binding registry
func (*Registry) ApplyConfigOverrides ¶ added in v0.77.0
func (r *Registry) ApplyConfigOverrides(cfg config.KeybindingsConfig) error
ApplyConfigOverrides applies keybinding configuration from config Only processes config bindings. Missing entries automatically use defaults already registered.
func (*Registry) GetActiveActions ¶
func (r *Registry) GetActiveActions(app KeyHandlerContext) []*KeyAction
GetActiveActions returns all currently active actions
func (*Registry) GetHelpShortcuts ¶
func (r *Registry) GetHelpShortcuts(app KeyHandlerContext) []HelpShortcut
GetHelpShortcuts generates help shortcuts for current context
func (*Registry) GetSequenceActionForPrefix ¶ added in v0.91.0
func (r *Registry) GetSequenceActionForPrefix(prefix string, app KeyHandlerContext) *KeyAction
GetSequenceActionForPrefix returns the action that matches a sequence starting with the given prefix
func (*Registry) HasSequenceWithPrefix ¶ added in v0.91.0
func (r *Registry) HasSequenceWithPrefix(prefix string, app KeyHandlerContext) bool
HasSequenceWithPrefix checks if any registered action has a key sequence that starts with the given prefix
func (*Registry) ListAllActions ¶ added in v0.77.0
ListAllActions returns all registered actions for debugging/management
func (*Registry) Register ¶
Register adds a new key binding action to the registry Multiple actions can share the same key - the layer system resolves conflicts based on context
func (*Registry) Resolve ¶
func (r *Registry) Resolve(key string, app KeyHandlerContext) *KeyAction
Resolve finds the appropriate key action for a key press
func (*Registry) Unregister ¶
Unregister removes a key binding action from the registry