Documentation
¶
Overview ¶
Package occupied classifies live composer occupancy by injecting a space and comparing before/after snapshots.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExactlyOneMoreSpace ¶
ExactlyOneMoreSpace reports whether after is before with exactly one ASCII space (0x20) inserted into real draft text. Both sides are newline-stripped first, then compared byte-by-byte.
Not occupied when:
- before is empty
- the space is inserted into an existing space run (padding)
- the space is inserted immediately after a composer/chrome glyph (›»❯│…)
func StripNewlines ¶
StripNewlines removes \n and \r so compares ignore line breaks.
Types ¶
type IO ¶
type IO struct {
Snapshot func() (string, error)
Inject func(text string) error // no-submit; Probe sends " " then "\x7f"
// Before is an optional resting snapshot. When non-empty, Probe skips the
// first Snapshot call (avoids a duplicate SnapshotText under idle Tick).
Before string
// Settle is how long to wait after injecting the space before reading
// after (0 → defaultProbeSettle).
Settle time.Duration
}
IO is the injectable snapshot/inject surface for Probe.
type Status ¶
type Status string
Status is composer occupancy from a space probe.
func Probe ¶
Probe types one space, waits Settle, snapshots, classifies with ExactlyOneMoreSpace, then always DELs the space.
exactly +1 draft space → Occupied any other / no change → Empty snapshot fail → Unknown inject fail → Empty (cannot prove occupancy; callers that need a hard hold should check Ready/writable separately)