Documentation
¶
Index ¶
Constants ¶
View Source
const ( CursorHide = "\x1b[?25l" CursorShow = "\x1b[?25h" ClearLine = "\r\x1b[K" CursorUp = "\x1b[A" EraseDown = "\x1b[J" SaveCursor = "\x1b[s" RestCursor = "\x1b[u" )
ANSI escape sequences for terminal control.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Key ¶ added in v0.7.0
type Key struct {
Name string // "up", "down", "left", "right", "return", "escape", "backspace", "delete", "space", "tab", "paste", or lowercase letter
Rune rune // The actual character (0 for special keys)
Ctrl bool // True if Ctrl modifier was pressed
Shift bool // True if Shift modifier was pressed
Content string // Paste content when Name == "paste"
}
Key represents a parsed keyboard input event.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader provides read-only access to the key channel.
type Terminal ¶
Terminal manages terminal I/O operations with channel-based key input.
func New ¶
New creates a new terminal instance and starts key reading. Uses a singleton pattern: the first call creates the TTY and readKeys goroutine, subsequent calls reuse the same terminal but create new Reader/Writer wrappers.
Click to show internal directories.
Click to hide internal directories.