Documentation
¶
Overview ¶
Package mouse demonstrates the click, double-click, wheel and drag affordances tuilib components expose when the app shell enables mouse input (app.Options.Mouse = app.MouseClick).
Nothing here is mouse-specific plumbing: the screen holds three ordinary components in a focus.Group and routes messages the usual way. Every behaviour below falls out of components knowing the rect layout gave them.
What to try:
- Click any pane to focus it — the border flips to its active colour.
- Click a row to move the cursor there; double-click to open it, the mouse spelling of enter (rule 14).
- Click a sortable table header to sort by it; click again to flip.
- Click a ▸/▾ glyph in the tree to expand or collapse that node. One click, because the glyph is drawn to say "this opens".
- Roll the wheel over any pane — including an unfocused one. The wheel does what ↓/j does for that component and never steals focus.
- Drag a scrollbar thumb, or click anywhere on its track to jump.
- Click a breadcrumb crumb to jump back up the stack, and the "? help" affordance in the statusbar to open the panel.
Index ¶
- func New(t theme.Theme) screen.Screen
- type Screen
- func (s *Screen) Help() []key.Binding
- func (s *Screen) HelpSections() []help.Section
- func (s *Screen) Init() tea.Cmd
- func (s *Screen) IsCapturingKeys() bool
- func (s *Screen) Layout() layout.Node
- func (s *Screen) OnEnter(any) tea.Cmd
- func (s *Screen) SetTheme(t theme.Theme)
- func (s *Screen) Title() string
- func (s *Screen) Update(msg tea.Msg) (screen.Screen, tea.Cmd)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Screen ¶
type Screen struct {
// contains filtered or unexported fields
}
func (*Screen) HelpSections ¶ added in v0.25.0
HelpSections puts the panes' own groups first and keeps the mouse vocabulary this example exists to demonstrate under one heading.
Mouse affordances carry sentinel keys so they flow through help.Compile without colliding (keyless bindings all dedup to one) and never match a real KeyMsg.