From 2ca284619125af0d5c12e9210ff1bfc8f9122739 Mon Sep 17 00:00:00 2001 From: Anders Betts Date: Wed, 23 Sep 2026 08:56:49 +0200 Subject: tui: one shared field editor, in-place form editing, value-only focus Forms edit fields in place in the value column instead of a bottom prompt, highlight only the focused value and scroll when taller than the screen; long text scrolls horizontally instead of wrapping. Fixes: typing after Backspace/Del no longer wipes the field, 'q' is text in row tables, the caret resets between cells, dialogs decode arrow keys, full buffers never take half a UTF-8 character, an invalid amount stays editable. Co-Authored-By: Claude Opus 5.5 --- scripts/tui-golden.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'scripts') diff --git a/scripts/tui-golden.py b/scripts/tui-golden.py index 4fee4df..9d6e9ca 100755 --- a/scripts/tui-golden.py +++ b/scripts/tui-golden.py @@ -61,6 +61,8 @@ KEYS = { "f5": "\x1b[15~", "f9": "\x1b[20~", "f2": "\x1bOQ", + "backspace": "\x7f", + "tab": "\t", } # {org_name} {org_nr} {fy_label} {fy_start} {fy_end} are substituted at run @@ -540,6 +542,50 @@ SCENARIOS = [ }, ], }, + { + # Backspace in a freshly opened field edits the value; the next + # key must not replace everything. + "name": "form-edit-backspace", + "screen": "customers", + "steps": [ + { + "keys": ["ctrln"], + "expect": ["Ny kund", ""], + }, + { + "keys": ["enter", "Bakstegskund", "enter"], + "expect": ["Bakstegskund"], + }, + { + "keys": ["enter", "backspace", "x", "enter"], + "expect": ["Bakstegskunx"], + }, + ], + }, + { + # Typing on a header field edits it in place; 'q' is text in both + # header fields and cells, never "back". + "name": "voucher-form-typing", + "screen": "vouchers", + "steps": [ + { + "keys": ["ctrln"], + "expect": ["Nytt verifikat", "Datum", "Konto"], + }, + { + "keys": ["20260315", "enter"], + "expect": ["Nytt verifikat", "2026-03-15"], + }, + { + "keys": ["down", "Qliro q", "enter"], + "expect": ["Nytt verifikat", "Qliro q"], + }, + { + "keys": ["1930", "tab", "tab", "tab", "equity q"], + "expect": ["Nytt verifikat", "1930", "equity q"], + }, + ], + }, ] # -------------------------------------------------------------------------- -- cgit v1.3