summaryrefslogtreecommitdiff
path: root/scripts/tui-golden.py
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-23 08:56:49 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-23 08:56:49 +0200
commit2ca284619125af0d5c12e9210ff1bfc8f9122739 (patch)
treea304096c2b58492d345e71f205571b913b555a23 /scripts/tui-golden.py
parent278d89825dcb25c4cc55891b84b96b6ca9b84354 (diff)
downloadbokf-2ca284619125af0d5c12e9210ff1bfc8f9122739.tar.gz
bokf-2ca284619125af0d5c12e9210ff1bfc8f9122739.zip
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 <noreply@anthropic.com>
Diffstat (limited to 'scripts/tui-golden.py')
-rwxr-xr-xscripts/tui-golden.py46
1 files changed, 46 insertions, 0 deletions
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", "<UTKAST>"],
+ },
+ {
+ "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"],
+ },
+ ],
+ },
]
# --------------------------------------------------------------------------