diff options
author | nicm <nicm> | 2020-01-27 08:53:13 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-01-27 08:53:13 +0000 |
commit | d0b8d036be97efc885f879aa63ce9bbb0efd8222 (patch) | |
tree | 44cfbf25fe998698cd423eb5a88a572426929715 /status.c | |
parent | 2e39b621c9b29b58b4bfe761989b14f0f13d07b6 (diff) | |
download | rtmux-d0b8d036be97efc885f879aa63ce9bbb0efd8222.tar.gz rtmux-d0b8d036be97efc885f879aa63ce9bbb0efd8222.tar.bz2 rtmux-d0b8d036be97efc885f879aa63ce9bbb0efd8222.zip |
Add support for adding a note to a key binding (with bind-key -N) and
use this to add descriptions to the default key bindings. A new -N flag
to list-keys shows key bindings with notes rather than the default
bind-key command used to create them. Change the default ? binding to
use this to show a readable summary of keys.
Also extend command-prompt to return the name of the key pressed and add
a default binding (/) to show the note for the next key pressed
Suggested by Alex Tremblay in GitHub issue 2000.
Diffstat (limited to 'status.c')
-rw-r--r-- | status.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -915,11 +915,17 @@ status_prompt_key(struct client *c, key_code key) { struct options *oo = c->session->options; char *s, *cp, word[64], prefix = '='; - const char *histstr, *ws = NULL; + const char *histstr, *ws = NULL, *keystring; size_t size, n, off, idx, used; struct utf8_data tmp, *first, *last, *ud; int keys; + if (c->prompt_flags & PROMPT_KEY) { + keystring = key_string_lookup_key(key); + c->prompt_inputcb(c, c->prompt_data, keystring, 1); + status_prompt_clear(c); + return (0); + } size = utf8_strlen(c->prompt_buffer); if (c->prompt_flags & PROMPT_NUMERIC) { |