Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var KeyScrollMap = map[string]ScrollDirection{ "up": ScrollUp, "k": ScrollUp, "down": ScrollDown, "j": ScrollDown, "pgup": ScrollPageUp, "pgdown": ScrollPageDown, "home": ScrollToTop, "end": ScrollToBottom, }
KeyScrollMap maps common scroll keys to directions
NavigationKeys are common keys used for navigation that components might want to handle. Note: vim-style keys (h, j, k, l) are intentionally excluded to avoid conflicts with typing in completion popups where users need to type those letters.
Functions ¶
func CmdHandler ¶
CmdHandler creates a command that returns the given message
func IsNavigationKey ¶
func IsNavigationKey(msg tea.KeyPressMsg) bool
IsNavigationKey returns true if the key is a common navigation key
func NewSimpleHelp ¶
NewSimpleHelp creates a new simple help system
func Resolve ¶ added in v1.44.0
Resolve retrieves a dependency of type T from the given tea.Model.
This function provides a type-safe way to access dependencies (such as *app.App, *service.SessionState, chat.Page, or editor.Editor) from a model that implements the Resolve(any) any method. The model acts as a dependency provider, allowing command handlers and other components to access shared state without tight coupling.
Usage:
app := core.Resolve[*app.App](model) sessionState := core.Resolve[*service.SessionState](model) chatPage := core.Resolve[chat.Page](model)
Panics if the model does not implement Resolve or cannot provide the requested type.
Experimental ¶
Notice: This function is EXPERIMENTAL and may be changed or removed in a later release.
Types ¶
type KeyMapHelp ¶
KeyMapHelp interface for components that provide help
type ScrollDirection ¶
type ScrollDirection int
ScrollDirection represents the direction of scrolling
const ( ScrollUp ScrollDirection = iota ScrollDown ScrollPageUp ScrollPageDown ScrollToTop ScrollToBottom )
func GetScrollDirection ¶
func GetScrollDirection(msg tea.KeyPressMsg) (ScrollDirection, bool)
GetScrollDirection returns the scroll direction for a key press, or -1 if not a scroll key