Unify TUI input editing in Tui::InputField - #134
Conversation
Steal try-cli's editor keys (arrows, Ctrl-U, Delete) into one Spinel-safe widget used by search, rename, graduate, and delete prompts, with emergency terminal restore on crash.
Short asciinema captures of the InputField editor (cursor motion, insert-in-middle, Ctrl-U) on both ruby try.rb and dist/try.
TUI demosSame key story on MRI and the Spinel native binary: type MRI ( Native / Spinel ( Playable asciinema (unclaimed uploads expire in 7 days):
|
Benchmark (hyperfine, MRI vs native)Measured 2026-08-13 16:04 EDT on this box. hyperfine 1.19.0, Speedup is MRI mean / native mean. Native won every case. | Case | MRI mean ± σ | native mean ± σ | Speedup |
|


Stacked on #133.
Steal from tobi/try-cli: one real input widget instead of four copy-pasted editors. try-cli's
tui_push/tui_popis an ANSI style stack, not a view stack; Ruby's Screen/Section/Line layout is already better, so this only ports the input/terminal layer.Tui::InputField#handle_keyused by search, rename, graduate, and the YES prompt#to_sunchanged (existing screenshots still match)TryEntry#method_missingreplaced with explicit accessorsat_exitrestores alt-screen / cooked / cursor if we crash in raw modeMRI and native: 399/399 (original 397 plus two keyboard tests).
runner_and_compare.sh13/13.Not in this PR: C style stack, C fuzzy scoring, ghost-placeholder rename UX, collapsing dialogs into a single-loop mode enum.
Demo
Same key story on both runtimes (cursor into
spin, insertx, Ctrl-A/E, Ctrl-U, rename):MRI
Native / Spinel
Playable: MRI asciinema · native asciinema
Benchmark (hyperfine)
MRI
ruby try.rbvs nativedist/try, 2026-08-13 16:04 EDT. hyperfine 1.19.0,--shell=none -w 3 -r 20. Ruby 3.3.8, Spinel79b1aba8bdef(PR 3906). Native at measurement was ~1.0 MiB unstripped; currentdist/tryafter-Os+strip is 705 KB. Native won every case.--help--versioninit--and-keys=betaexec betaclonescriptworktreescriptinitstill forkspsto detect fish vs bash (~20 ms on native). The 1000-entry filter is whole-process (scan + four keystrokes + re-renders), not an isolated matcher.