diff options
author | 2017-06-23 15:36:52 +0000 | |
---|---|---|
committer | 2017-06-23 15:36:52 +0000 | |
commit | b846cb6cccfba9caf5d45f1a96b6f65dd3640a4f (patch) | |
tree | d42d1d557e1c95eee116584921089abde2ca0644 /usr.bin/tmux/key-string.c | |
parent | - Fix Tx queues to USB endpoints mapping and merge urtwn_r92c_dma_init() (diff) | |
download | wireguard-openbsd-b846cb6cccfba9caf5d45f1a96b6f65dd3640a4f.tar.xz wireguard-openbsd-b846cb6cccfba9caf5d45f1a96b6f65dd3640a4f.zip |
Add user-keys option to allow user-defined keys to be set, from Dan
Aloni.
Diffstat (limited to 'usr.bin/tmux/key-string.c')
-rw-r--r-- | usr.bin/tmux/key-string.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c index 6f961a03d86..380f7886eb5 100644 --- a/usr.bin/tmux/key-string.c +++ b/usr.bin/tmux/key-string.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-string.c,v 1.46 2017/06/12 07:04:24 nicm Exp $ */ +/* $OpenBSD: key-string.c,v 1.47 2017/06/23 15:36:52 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -110,12 +110,16 @@ static const struct { static key_code key_string_search_table(const char *string) { - u_int i; + u_int i, user; for (i = 0; i < nitems(key_string_table); i++) { if (strcasecmp(string, key_string_table[i].string) == 0) return (key_string_table[i].key); } + + if (sscanf(string, "User%u", &user) == 1 && user < KEYC_NUSER) + return (KEYC_USER + user); + return (KEYC_UNKNOWN); } @@ -265,6 +269,10 @@ key_string_lookup_key(key_code key) return ("MouseMoveStatus"); if (key == KEYC_MOUSEMOVE_BORDER) return ("MouseMoveBorder"); + if (key >= KEYC_USER && key < KEYC_USER + KEYC_NUSER) { + snprintf(out, sizeof out, "User%u", (u_int)(key - KEYC_USER)); + return (out); + } /* * Special case: display C-@ as C-Space. Could do this below in |