Skip to content

tui: Ink's counter, borders, use-focus and static side by side, a text field, and the README's front - #404

Merged
shreeve merged 2 commits into
mainfrom
tui/examples
Sep 22, 2026
Merged

shreeve merged 2 commits into
mainfrom
tui/examples

Conversation

@shreeve

@shreeve shreeve commented Sep 22, 2026

Copy link
Copy Markdown
Owner

PLAN step 6, the examples half.

Four of Ink's examples, ported. examples/ink/{counter,borders,use-focus,static}.rip, each the same program as Ink's <name>.tsx beside it (copied unmodified; NOTICE names them). Each port was run against Ink 7.1.1's own frames for the same program: every frame is identical, so no stated difference was needed. Lines, non-blank and non-comment, counted by test/lines.rip and asserted by test/examples.rip:

Example Ink Rip TUI
counter 15 6
borders 34 21
use-focus 26 19
static 45 14

Two behaviors stated in the file headers: borders says flexDirection: 'row' on its two rows since a Box here is a column; static calls quit() at its tenth test, since Ink's process ends when its last timer drains while run holds stdin.

A text field. examples/input.rip, 40 code lines: typing inserts one code point at the cursor, arrows, Home and End move it, Backspace and Delete take one grapheme cluster, a paste inserts whole, Enter prints the value above the frame and clears, Escape clears; the cursor is placed by cursor: with the column measured over the clusters before it. This is the text-input example PLAN step 4's exit named.

Every example runs headless through mount in test/examples.rip (7 tests): the timer counter driven by view.tick, focus by Tab, the static scrollback and live frame, the field's frame and view.cursor after each key. Each also runs from a terminal (rip examples/ink/counter.rip) through the run X if import.meta.main guard.

README. The top reads, in order: the thesis in plain words; a quick start on the keyboard counter with the two commands; the feature matrix reconciled with what is built (every row of "Matches Ink" and "Beyond Ink" is built and under test; TODO lists the open work within them); the four examples side by side with their lines; the examples table. A <!-- bench --> marker holds the place for the published numbers, which the bench half writes.

One gap found and listed in TODO, not fixed: a stdout.columns of 0 draws empty frames where undefined reads as 80.

Suites unchanged plus examples 7; root style gate passes.

@shreeve
shreeve merged commit 12415f0 into main Sep 22, 2026
2 checks passed
@shreeve
shreeve deleted the tui/examples branch September 22, 2026 05:36
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