Documentation
¶
Overview ¶
Package program is the in-program half of rexuikit/surface: what a bubbletea program running inside a surface needs to see focus the way Rex delivers it. It is the only part of surface that imports bubbletea, so a placer that never runs a TUI does not link it.
Rex forwards terminal focus reports (DECSET 1004) to the focused block, but how many depends on the app: the live tests saw exactly one ESC[I and one ESC[O per change with no app drawing the window, and one in plus two out with the app drawing it (rex-behaviors.md; livetest TestFocusReportsForwarded). Dedupe therefore collapses identical consecutive reports that arrive close together and never pair-counts, so a Rex that sends each report once, twice, or unevenly all read the same.
Index ¶
Constants ¶
const DefaultDedupeWindow = 50 * time.Millisecond
DefaultDedupeWindow is how close two identical focus reports must be to count as one. Rex's duplicates arrive back to back; a real focus change back to the same state needs a different report in between anyway.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dedupe ¶
type Dedupe struct {
Window time.Duration
Now func() time.Time
// contains filtered or unexported fields
}
Dedupe drops a focus report identical to the previous one when it arrives within Window of it. The zero value uses DefaultDedupeWindow and the wall clock.
func (*Dedupe) Duplicate ¶
Duplicate reports whether msg is a FocusMsg or BlurMsg repeating the previous report within the window, and records it otherwise. Any other message passes through and leaves the state alone: a keypress between two identical reports does not make the second one a new change.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model wraps a program's model: it turns on focus reporting, drops duplicate focus reports before the inner model sees them, and applies the surface's BlurPolicy.
type Options ¶
type Options struct {
Blur surface.BlurPolicy
// Dedupe overrides the duplicate filter's window and clock (tests).
Dedupe Dedupe
}
Options configure Wrap.