Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnsupportedMessage = fmt.Errorf("unsupported message")
ErrUnsupportedMessage is returned on an attempt to Send an unsupported object or message.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(r *reader)
Option tells the Reader how to behave.
func WatchMouseAll ¶
func WatchMouseAll() Option
WatchMouseAll makes Reader watch and pipe Mouse click and move events.
func WatchMouseClick ¶
func WatchMouseClick() Option
WatchMouseClick makes Reader watch and pipe Mouse click events.
func WatchWindowSize ¶
func WatchWindowSize() Option
WatchWindowSize makes Reader watch and pipe Window size/resize events.
type Reader ¶
type Reader interface {
// Begin begins reading inputs.
Begin(ctx context.Context)
// End terminates reading.
End()
// Errors returns the channel with errors encountered while reading.
Errors() <-chan error
// KeyEvents returns the channel with events from the Keyboard.
KeyEvents() <-chan tea.KeyMsg
// MouseEvents returns the channel with events from the Mouse.
MouseEvents() <-chan tea.MouseMsg
// Send sends the message over the appropriate channel back to client. This
// can be useful for testing and automated inputs.
Send(msg any) error
// WindowSizeEvents returns the channel with resize events from the Terminal
// window.
WindowSizeEvents() <-chan tea.WindowSizeMsg
// Reset resets everything and prepares for new input, and will block if
// called when reading is in progress and has not been End-ed yet.
Reset() error
}
Reader channels Key, Mouse and Window Resize events to the caller through the publicly defined channels below. The caller needs to drain all the channels to prevent blocking.
It uses BubbleTea framework underneath the hood to make this happen, but provides a cleaner interface to just input handling.
Click to show internal directories.
Click to hide internal directories.