Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tty ¶
Tty is a wrapper around github.com/mattn/go-tty. While go-tty reads input per rune, control keys may be sent as multiple runes. To handle this, Tty buffers input and provides the GetKey method to retrieve keys per physical key press. It also replaces the terminal size notification mechanism from a channel of go-tty's WINSIZE to a callback function, making it easier to abstract single-character input handling.
func (*Tty) Close ¶
Close calls go-tty's `Close` method to shut down the Tty instance. It clears internal references (by overwriting them with nil) to prevent reuse. Since go-tty closes the SIGWINCH channel, the goroutine started by Open detects the channel closure and terminates automatically.
func (*Tty) GetKey ¶
GetKey switches the terminal to raw mode and reads a single key input. Since control keys may consist of multiple runes, the result is returned as a string. Any unread input is buffered internally and returned on subsequent calls. After processing, the terminal is restored to cooked mode.