input

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package input implements vim-style copy mode for TUIOS.

Package input implements vim-style copy mode for TUIOS.

Package input implements vim-style copy mode for TUIOS.

Package input implements vim-style copy mode for TUIOS.

Package input implements vim-style copy mode for TUIOS.

Package input implements vim-style copy mode for TUIOS.

Package input implements TUIOS input handling and key forwarding.

This module handles keyboard input in both Window Management and Terminal modes.

Package input implements key mapping definitions and ANSI escape sequence builders for TUIOS.

This module handles: - Converting Bubble Tea KeyPressMsg to raw terminal bytes - ANSI/VT escape sequence generation for terminal compatibility - Function key support with modifier combinations - macOS Option key character mappings

Package input implements keyboard event handling for TUIOS.

Package input implements mouse event handling for TUIOS.

Package input implements text selection logic for TUIOS.

Index

Constants

View Source
const PrefixKeyTimeout = 2 * time.Second

PrefixKeyTimeout is the duration after which prefix mode times out

Variables

This section is empty.

Functions

func BuildANSISequence

func BuildANSISequence(msg tea.KeyPressMsg) string

BuildANSISequence is a public helper that builds an ANSI escape sequence for a key. This can be useful for testing or debugging key sequences.

func ForwardKeyToTerminal

func ForwardKeyToTerminal(msg tea.KeyPressMsg, w interface{ SendInput([]byte) error }) tea.Cmd

ForwardKeyToTerminal is a convenience function that can be called to forward a key directly to a terminal window. This is useful for implementing key forwarding in other parts of the application.

func HandleCopyModeKey added in v0.0.16

func HandleCopyModeKey(msg tea.KeyPressMsg, o *app.OS, window *terminal.Window) (*app.OS, tea.Cmd)

HandleCopyModeKey is the main dispatcher for copy mode input

func HandleCopyModeMouseClick added in v0.0.16

func HandleCopyModeMouseClick(cm *terminal.CopyMode, window *terminal.Window, clickX, clickY int)

HandleCopyModeMouseClick handles mouse clicks in copy mode

func HandleCopyModeMouseDrag added in v0.0.16

func HandleCopyModeMouseDrag(cm *terminal.CopyMode, window *terminal.Window, startX, startY int)

HandleCopyModeMouseDrag handles mouse drag start in copy mode (initiates visual selection)

func HandleCopyModeMouseMotion added in v0.0.16

func HandleCopyModeMouseMotion(cm *terminal.CopyMode, window *terminal.Window, mouseX, mouseY int) int

HandleCopyModeMouseMotion handles mouse motion during drag in copy mode. Returns the auto-scroll direction: -1 (up), 0 (none), 1 (down).

func HandleDebugPrefixCommand added in v0.0.23

func HandleDebugPrefixCommand(msg tea.KeyPressMsg, o *app.OS) (*app.OS, tea.Cmd)

HandleDebugPrefixCommand handles debug prefix commands (Ctrl+B, D, ...) in window management mode

func HandleInput

func HandleInput(msg tea.Msg, o *app.OS) (tea.Model, tea.Cmd)

HandleInput is the main input coordinator that routes messages to appropriate handlers

func HandleKeyPress

func HandleKeyPress(msg tea.KeyPressMsg, o *app.OS) (*app.OS, tea.Cmd)

HandleKeyPress handles all keyboard input and routes to mode-specific handlers

func HandleMinimizePrefixCommand

func HandleMinimizePrefixCommand(msg tea.KeyPressMsg, o *app.OS) (*app.OS, tea.Cmd)

HandleMinimizePrefixCommand handles minimize prefix commands (Ctrl+B, m, ...)

func HandlePrefixCommand

func HandlePrefixCommand(msg tea.KeyPressMsg, o *app.OS) (*app.OS, tea.Cmd)

HandlePrefixCommand handles prefix commands (Ctrl+B followed by another key)

func HandleScrollbackBrowserKey added in v0.7.0

func HandleScrollbackBrowserKey(msg tea.KeyPressMsg, o *app.OS) (*app.OS, tea.Cmd)

HandleScrollbackBrowserKey handles keyboard input when the scrollback browser is open.

func HandleTapePrefixCommand added in v0.4.0

func HandleTapePrefixCommand(msg tea.KeyPressMsg, o *app.OS) (*app.OS, tea.Cmd)

HandleTapePrefixCommand handles tape prefix commands (Ctrl+B, T, ...) in window management mode

func HandleTerminalModeKey

func HandleTerminalModeKey(msg tea.KeyPressMsg, o *app.OS) (*app.OS, tea.Cmd)

HandleTerminalModeKey handles keyboard input in terminal mode

func HandleTilingPrefixCommand

func HandleTilingPrefixCommand(msg tea.KeyPressMsg, o *app.OS) (*app.OS, tea.Cmd)

HandleTilingPrefixCommand handles tiling/window prefix commands (Ctrl+B, t, ...) in window management mode

func HandleWindowManagementModeKey

func HandleWindowManagementModeKey(msg tea.KeyPressMsg, o *app.OS) (*app.OS, tea.Cmd)

HandleWindowManagementModeKey handles keyboard input in window management mode

func HandleWorkspacePrefixCommand

func HandleWorkspacePrefixCommand(msg tea.KeyPressMsg, o *app.OS) (*app.OS, tea.Cmd)

HandleWorkspacePrefixCommand handles workspace prefix commands (Ctrl+B, w, ...)

func IsMacOSOptionKey

func IsMacOSOptionKey(r rune) (digit int, ok bool)

IsMacOSOptionKey checks if a rune represents a macOS Option+digit key press and returns the digit (1-9) and true if it matches, or 0 and false otherwise.

macOS Option key mappings: Option+1 → ¡, Option+2 → ™, Option+3 → £, Option+4 → ¢, Option+5 → ∞ Option+6 → §, Option+7 → ¶, Option+8 → •, Option+9 → ª

func IsMacOSOptionShiftKey

func IsMacOSOptionShiftKey(r rune) (digit int, ok bool)

IsMacOSOptionShiftKey checks if a rune represents a macOS Option+Shift+digit key press and returns the digit (1-9) and true if it matches, or 0 and false otherwise.

macOS Option+Shift key mappings: Option+Shift+1 → ⁄, Option+Shift+2 → €, Option+Shift+3 → ‹, Option+Shift+4 → › Option+Shift+5 → fi, Option+Shift+6 → fl, Option+Shift+7 → ‡, Option+Shift+8 → ° Option+Shift+9 → ·

func IsMacOSOptionTab added in v0.6.0

func IsMacOSOptionTab(r rune) string

IsMacOSOptionTab checks if a rune represents a macOS Option+Tab or Option+Shift+Tab key press. Returns "next" for opt+tab (⇥), "prev" for opt+shift+tab (⇤), or "" if no match.

macOS Option+Tab mappings: Option+Tab → ⇥ (U+21E5, Rightwards Arrow to Bar) Option+Shift+Tab → ⇤ (U+21E4, Leftwards Arrow to Bar)

func MoveDown added in v0.0.16

func MoveDown(cm *terminal.CopyMode, window *terminal.Window)

MoveDown moves cursor down

func MoveLeft added in v0.0.16

func MoveLeft(cm *terminal.CopyMode, window *terminal.Window)

MoveLeft moves cursor left

func MoveRight added in v0.0.16

func MoveRight(cm *terminal.CopyMode, window *terminal.Window)

MoveRight moves cursor right

func MoveUp added in v0.0.16

func MoveUp(cm *terminal.CopyMode, window *terminal.Window)

MoveUp moves cursor up

func OpenScrollbackBrowser added in v0.7.0

func OpenScrollbackBrowser(o *app.OS)

OpenScrollbackBrowser opens the scrollback browser for the focused terminal window.

func UpdateVisualEnd added in v0.7.0

func UpdateVisualEnd(cm *terminal.CopyMode, window *terminal.Window)

UpdateVisualEnd updates the visual selection end position (exported for auto-scroll).

Types

type ActionDispatcher added in v0.0.23

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

ActionDispatcher maps action names to handler functions

func GetDispatcher added in v0.0.23

func GetDispatcher() *ActionDispatcher

GetDispatcher returns the global action dispatcher

func NewActionDispatcher added in v0.0.23

func NewActionDispatcher() *ActionDispatcher

NewActionDispatcher creates a new action dispatcher with all handlers registered

func (*ActionDispatcher) Dispatch added in v0.0.23

func (d *ActionDispatcher) Dispatch(action string, msg tea.KeyPressMsg, o *app.OS) (*app.OS, tea.Cmd)

Dispatch executes the handler for a given action

func (*ActionDispatcher) HasAction added in v0.0.23

func (d *ActionDispatcher) HasAction(action string) bool

HasAction checks if an action is registered

func (*ActionDispatcher) Register added in v0.0.23

func (d *ActionDispatcher) Register(action string, handler ActionHandler)

Register adds an action handler

type ActionHandler added in v0.0.23

type ActionHandler func(_ tea.KeyPressMsg, o *app.OS) (*app.OS, tea.Cmd)

ActionHandler is a function that handles a specific action

Jump to

Keyboard shortcuts

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