filters

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package filters is a two-filterable-pane screen — the shape that exposes how focus behaves when a component has more than one place to type.

A filterable component holds two focusable regions behind a single focus.Focusable: the filter and the body. Put two such components on one screen and the interesting cases appear:

  • Exactly one region anywhere on screen should read as active. Clicking a filter must take the highlight off its own body, not just add a second highlight.
  • Clicking a body must take input back from its filter. Otherwise the filter keeps swallowing keys with nothing on screen saying so.
  • Moving focus to the other pane must clear the region you left, including its filter. A filter left focused on a blurred component is invisible and still eats keystrokes.
  • tab must not cycle while a filter is taking input — it would strand a half-typed query, and pkg/table binds tab to complete a key:value term.

The two panes are deliberately different components (a list and a table) because their filters differ: the table's parses `key:value` terms and completes them on tab, which is exactly the binding a focus group would otherwise steal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(t theme.Theme) screen.Screen

New returns the two-filter demo screen.

Types

type Screen

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

func (*Screen) Help

func (s *Screen) Help() []key.Binding

func (*Screen) HelpSections

func (s *Screen) HelpSections() []help.Section

HelpSections is what the `?` overlay reads. Two filterable panes put nearly forty bindings on this screen, and the footer's flat list cannot say which of them belong to the files pane and which to the rows — the Group can, because it holds both.

func (*Screen) Init

func (s *Screen) Init() tea.Cmd

func (*Screen) IsCapturingKeys

func (s *Screen) IsCapturingKeys() bool

IsCapturingKeys is answered by whichever pane holds focus, which in turn reports true only while its own filter is taking input.

func (*Screen) Layout

func (s *Screen) Layout() layout.Node

func (*Screen) OnEnter

func (s *Screen) OnEnter(any) tea.Cmd

func (*Screen) SetTheme

func (s *Screen) SetTheme(t theme.Theme)

func (*Screen) Title

func (s *Screen) Title() string

func (*Screen) Update

func (s *Screen) Update(msg tea.Msg) (screen.Screen, tea.Cmd)

Jump to

Keyboard shortcuts

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