summaryrefslogtreecommitdiff
path: root/clients/tui.c
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-21 15:50:37 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-21 15:50:37 +0200
commit69777086ffad917b7a48d57df9dccf4e21a0a364 (patch)
tree91a0d4a2e02dd589e9d5066248a031776892d772 /clients/tui.c
parentdb03b0b2875e6981fdb86c5c3c23d1a59280f222 (diff)
downloadbokf-0.1.59.tar.gz
bokf-0.1.59.zip
tui: level-2 modifyOtherKeys, Kitty keyboard protocol and ^Enter/F9 hintsv0.1.59
Diffstat (limited to 'clients/tui.c')
-rw-r--r--clients/tui.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/clients/tui.c b/clients/tui.c
index 031fad0..30761a8 100644
--- a/clients/tui.c
+++ b/clients/tui.c
@@ -159,9 +159,34 @@ int tui_sticky_split(char **lines, int n, char **head, int *nhead)
void tui_keys_setup(void)
{
- /* ^Enter has no control code; enable xterm modifyOtherKeys and bind the
- sequence it produces. Terminals without it ignore the request. */
+ /* ^Enter has no control code; enable xterm modifyOtherKeys level 2 (level
+ 1 leaves control+Enter alone) and the Kitty keyboard protocol, then bind
+ the sequences they produce. Terminals with neither keep F9 working. */
+ putp("\033[>4;2m");
+ putp("\033[>1u");
+ fflush(stdout);
define_key("\033[27;5;13~", TUI_KEY_CTRL_ENTER);
+ define_key("\033[13;5u", TUI_KEY_CTRL_ENTER);
+ define_key("\033[27;2;9~", KEY_BTAB);
+ define_key("\033[9;2u", KEY_BTAB);
+ define_key("\033[27u", 27);
+ define_key("\033[27;1u", 27);
+ define_key("\033[27;5;97~", 1);
+ define_key("\033[97;5u", 1);
+ define_key("\033[27;5;99~", 3);
+ define_key("\033[99;5u", 3);
+ define_key("\033[27;5;101~", 5);
+ define_key("\033[101;5u", 5);
+ define_key("\033[27;5;102~", 6);
+ define_key("\033[102;5u", 6);
+ define_key("\033[27;5;110~", 14);
+ define_key("\033[110;5u", 14);
+ define_key("\033[27;5;114~", 18);
+ define_key("\033[114;5u", 18);
+ define_key("\033[27;5;117~", 21);
+ define_key("\033[117;5u", 21);
+ define_key("\033[27;5;120~", 24);
+ define_key("\033[120;5u", 24);
/* Home/End arrive as CSI or SS3 depending on the terminal */
define_key("\033[1~", KEY_HOME);
define_key("\033OH", KEY_HOME);
@@ -184,8 +209,6 @@ void tui_keys_setup(void)
init_pair(TUI_CP_RULE, COLOR_BLUE, -1);
init_pair(TUI_CP_STATUS, COLOR_CYAN, -1);
}
- putp("\033[>4;1m");
- fflush(stdout);
}
@@ -1592,7 +1615,7 @@ static int form_run(const char *title, struct tui_form_field *f, int nf,
h = na > 0
? (can_edit
? "upp/ned/Tab = flytta Enter = ändra/utför"
- " F5 = uppdatera ^Enter = spara"
+ " F5 = uppdatera ^Enter/F9 = spara"
" Esc/q = tillbaka ^C = avsluta"
: "upp/ned/Tab = flytta Enter = utför"
" F5 = uppdatera Esc/q = tillbaka"
@@ -1600,7 +1623,7 @@ static int form_run(const char *title, struct tui_form_field *f, int nf,
" (endast behöriga kan ändra)")
: (can_edit
? "upp/ned/Home/End Enter = ändra"
- " F5 = uppdatera ^Enter = spara"
+ " F5 = uppdatera ^Enter/F9 = spara"
" Esc/q = tillbaka ^C = avsluta"
: "upp/ned/Home/End F5 = uppdatera"
" Esc/q = tillbaka ^C = avsluta"