diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2024-08-21 04:17:10 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2024-08-21 04:17:10 +0000 |
commit | 68678c1d7b3238e8b1cebb2e8d3123afcc8966f1 (patch) | |
tree | 1af3ae7780f15e3d527b256886aa92d8b2053934 /usr.bin/tmux/format.c | |
parent | 684cbf0b8edc0de26da51c1f789cc31508c4715b (diff) |
Revamp extended keys support to more closely match xterm and support
mode 2 as well as mode 1. From Stanislav Kljuhhin (GitHub issue 4038).
This changes tmux to always request mode 2 from parent terminal, change
to an unambiguous internal representation of keys, and adds an option
(extended-keys-format) to control the format similar to the xterm(1)
formatOtherKeys resource.
Diffstat (limited to 'usr.bin/tmux/format.c')
-rw-r--r-- | usr.bin/tmux/format.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 2377697bcba..aa17e924ffe 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.318 2023/09/08 06:52:31 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.319 2024/08/21 04:17:09 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1962,6 +1962,23 @@ format_cb_pane_unseen_changes(struct format_tree *ft) return (NULL); } +/* Callback for pane_key_mode. */ +static void * +format_cb_pane_key_mode(struct format_tree *ft) +{ + if (ft->wp != NULL && ft->wp->screen != NULL) { + switch (ft->wp->screen->mode & EXTENDED_KEY_MODES) { + case MODE_KEYS_EXTENDED: + return (xstrdup("Ext 1")); + case MODE_KEYS_EXTENDED_2: + return (xstrdup("Ext 2")); + default: + return (xstrdup("VT10x")); + } + } + return (NULL); +} + /* Callback for pane_last. */ static void * format_cb_pane_last(struct format_tree *ft) @@ -2997,6 +3014,9 @@ static const struct format_table_entry format_table[] = { { "pane_input_off", FORMAT_TABLE_STRING, format_cb_pane_input_off }, + { "pane_key_mode", FORMAT_TABLE_STRING, + format_cb_pane_key_mode + }, { "pane_last", FORMAT_TABLE_STRING, format_cb_pane_last }, |