summaryrefslogtreecommitdiff
path: root/scripts/check-consistency.sh
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-23 10:58:17 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-23 10:58:17 +0200
commit71a702f375750829c634b552217c9925d549828b (patch)
tree2b963da1d0110ed43920722ba4193ee9c79f2521 /scripts/check-consistency.sh
parent8ccb6d58d8e2f1c65dfd7ab5f0eb7d93f1f19def (diff)
downloadbokf-71a702f375750829c634b552217c9925d549828b.tar.gz
bokf-71a702f375750829c634b552217c9925d549828b.zip
tui: context menu on → / ^O; no F-keys, ^N or ^Enter
→ (where no caret uses it) and ^O (everywhere, also in table cells) open "Åtgärder": a box at the right edge with every action of the view and its key. Screens declare their actions with tui_set_actions(); choosing one feeds its key to the widget, so the menu and accelerators share one path. Function keys, Ctrl+N (now n), Ctrl+Enter and Ctrl+F are gone and no extended keyboard protocol is enabled, so the TUI works in a browser terminal; save/post/validate/preview/template/attach are menu actions. make check rejects F-keys, ^N and ^Enter in clients/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'scripts/check-consistency.sh')
-rwxr-xr-xscripts/check-consistency.sh25
1 files changed, 24 insertions, 1 deletions
diff --git a/scripts/check-consistency.sh b/scripts/check-consistency.sh
index 3ca9b0c..d8054e2 100755
--- a/scripts/check-consistency.sh
+++ b/scripts/check-consistency.sh
@@ -6,7 +6,10 @@
# "Command", and vice versa;
# 2. every error code passed to fail()/failf()/add_error() in src/*.c is
# documented in PROTOCOL.md section 5.3, and vice versa (documented but
-# unused codes are warnings only, some are reserved).
+# unused codes are warnings only, some are reserved);
+# 3. the TUI uses no key a browser terminal cannot deliver: no function
+# keys (KEY_F), no Ctrl+N and no Ctrl+Enter (docs/TUI-GUIDELINES.md
+# "Keys and the web").
#
# Run from the repo root: sh scripts/check-consistency.sh
# Exits 0 when there is no drift, 1 when drift is found, 2 on parse errors.
@@ -19,6 +22,8 @@
# PROTOCOL_MD protocol document, default $REPO_ROOT/docs/PROTOCOL.md
# SRC_GLOB shell glob of sources scanned for error codes,
# default $REPO_ROOT/src/*.c
+# CLIENTS_GLOB shell glob of TUI sources scanned for keys,
+# default $REPO_ROOT/clients/*.c
#
# Commands deliberately kept out of the PROTOCOL.md tables. Prefer documenting
# the command in a table over adding it here. Keep sorted, space separated.
@@ -188,6 +193,24 @@ else
echo "(none)"
fi
+section "keys: F-keys, Ctrl+N or Ctrl+Enter used in the TUI"
+CLIENTS_GLOB=${CLIENTS_GLOB:-"$REPO_ROOT/clients/*.c"}
+: > "$tmp/bad_keys"
+for f in $CLIENTS_GLOB; do
+ [ -f "$f" ] || continue
+ grep -nE 'KEY_F\(|TUI_KEY_CTRL_N|KEY_CTRL_N|CTRL_ENTER' "$f" |
+ sed "s|^|$f:|" >> "$tmp/bad_keys" || true
+done
+if [ -s "$tmp/bad_keys" ]; then
+ while IFS= read -r line; do
+ echo "key: not web-safe: $line"
+ problems=$((problems + 1))
+ done < "$tmp/bad_keys"
+ status=1
+else
+ echo "(none)"
+fi
+
section "warnings (not failures)"
if [ -s "$tmp/code_unused" ]; then
while IFS= read -r code; do