mirror of
https://github.com/tmux/tmux.git
synced 2026-10-07 02:04:22 +00:00
Cleanup.
This commit is contained in:
40
format.c
40
format.c
@@ -1617,6 +1617,43 @@ format_cb_client_height(struct format_tree *ft)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Callback for client_key_mode. */
|
||||
static void *
|
||||
format_cb_client_key_mode(struct format_tree *ft)
|
||||
{
|
||||
struct client *c = ft->c;
|
||||
const char *mode;
|
||||
char *s;
|
||||
int kitty, eks;
|
||||
|
||||
if (c == NULL || (~c->tty.flags & TTY_STARTED))
|
||||
return (NULL);
|
||||
|
||||
if (c->tty.flags & TTY_KKBPUSHED) {
|
||||
xasprintf(&s, "Kitty %u", c->tty.kitty_keys);
|
||||
return (s);
|
||||
}
|
||||
|
||||
/* This mirrors the choice made in tty_update_features(). */
|
||||
kitty = ((c->tty.flags & (TTY_HAVEKKB|TTY_KKBSUPPORT)) ==
|
||||
(TTY_HAVEKKB|TTY_KKBSUPPORT));
|
||||
eks = (options_get_number(global_options, "extended-keys") != 0);
|
||||
if (kitty && options_get_number(global_options,
|
||||
"extended-keys-format") == EXTENDED_KEYS_KITTY)
|
||||
eks = 0;
|
||||
if (eks && tty_term_has(c->tty.term, TTYC_ENEKS))
|
||||
mode = "Ext";
|
||||
else
|
||||
mode = "VT10x";
|
||||
|
||||
/* The terminal supports Kitty keys but they are not in use. */
|
||||
if (kitty) {
|
||||
xasprintf(&s, "%s (Kitty)", mode);
|
||||
return (s);
|
||||
}
|
||||
return (xstrdup(mode));
|
||||
}
|
||||
|
||||
/* Callback for client_key_table. */
|
||||
static void *
|
||||
format_cb_client_key_table(struct format_tree *ft)
|
||||
@@ -3652,6 +3689,9 @@ static const struct format_table_entry format_table[] = {
|
||||
{ "client_height", FORMAT_TABLE_STRING,
|
||||
format_cb_client_height
|
||||
},
|
||||
{ "client_key_mode", FORMAT_TABLE_STRING,
|
||||
format_cb_client_key_mode
|
||||
},
|
||||
{ "client_key_table", FORMAT_TABLE_STRING,
|
||||
format_cb_client_key_table
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user