Skip to content

tui: autofocus, Static and a size of 0 refused or read as they should be, focus given back when a dialog closes, and a modal box holds Tab - #408

Merged
shreeve merged 7 commits into
mainfrom
tui/remainders
Sep 22, 2026
Merged

shreeve merged 7 commits into
mainfrom
tui/remainders

Conversation

@shreeve

@shreeve shreeve commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Five items from TODO.md, one commit each.

A break space at the width. The TODO said Ink drops a space that ends a line exactly at the width, where this package keeps it at the head of the next line. It does not: published Ink 7.1.1 draws Box width: 5 holding Text "abcde fgh" as "abcde\n fgh", as this package does, and drops the space only at a fractional width, where this package already matches it. Changing the wrapper made three of Ink's own ported cases fail. The TODO line and PLAN §11's sentence are gone, and test/text.rip pins the frame Ink draws.

autofocus without focusable is refused by name when the claim is settled, since the two attributes arrive in either order: rip/tui: autofocus on <div> that is not focusable — write focusable: true, with the node's path. A disabled node still claims nothing, silently.

A bare text under Static is refused by name as it is inserted: only an element can be written once and put away.

A stream's columns or rows that is not a whole number above zero reads as 80 by 24, as an undefined one does and as Ink reads 0 — a pty whose size was never set drew frames of no cells.

Focus goes back, and modal holds Tab. When the focused node leaves the tree, focus goes back to the node it took focus from, if that node can still hold it, else to nothing; inside one modal box a node keeps the holder the box was entered from, so Tab going round the dialog does not overwrite it. An autofocus claim inside a modal box takes focus from a holder outside it, so a dialog opening over a focused list takes the keyboard. Tab and Shift-Tab from inside a modal: true box wrap within the innermost one; from outside any modal they walk the tree as before. A hidden or disabled holder still falls to nothing, and nested modal boxes removed together give back nothing (stated and pinned). The focus fuzz opens and closes dialogs, holds that Tab never leaves a modal and that focus is given back exactly when it can be, with floors on every counter.

Each item was seeded with single-line bugs and each is caught. Line counts regenerated by bun run lines (4,308; 2.3× with Yoga 3.2.1's algorithm).

Suites: test 134, text 49, layout 57, input 316, events 232, mouse 65, ink 540, yoga 543 (4 pinned), yoga-aspect 37, yoga-hand 53, fuzz 7, damage 6, terminal 79, examples 7.

@shreeve
shreeve merged commit 6540893 into main Sep 22, 2026
2 checks passed
@shreeve
shreeve deleted the tui/remainders branch September 22, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant