mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Separate key flags and modifiers, log key flags, make the "xterm" flag more
explicit and fix M- keys with a leading escape.
This commit is contained in:
parent
031d4864a9
commit
340fd691cb
@ -73,7 +73,7 @@ cmd_list_keys_get_width(const char *tablename, key_code only)
|
|||||||
bd = key_bindings_next(table, bd);
|
bd = key_bindings_next(table, bd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
width = utf8_cstrwidth(key_string_lookup_key(bd->key));
|
width = utf8_cstrwidth(key_string_lookup_key(bd->key, 0));
|
||||||
if (width > keywidth)
|
if (width > keywidth)
|
||||||
keywidth = width;
|
keywidth = width;
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ cmd_list_keys_print_notes(struct cmdq_item *item, struct args *args,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
found = 1;
|
found = 1;
|
||||||
key = key_string_lookup_key(bd->key);
|
key = key_string_lookup_key(bd->key, 0);
|
||||||
|
|
||||||
if (bd->note == NULL || *bd->note == '\0')
|
if (bd->note == NULL || *bd->note == '\0')
|
||||||
note = cmd_list_print(bd->cmdlist, 1);
|
note = cmd_list_print(bd->cmdlist, 1);
|
||||||
@ -135,7 +135,7 @@ cmd_list_keys_get_prefix(struct args *args, key_code *prefix)
|
|||||||
*prefix = options_get_number(global_s_options, "prefix");
|
*prefix = options_get_number(global_s_options, "prefix");
|
||||||
if (!args_has(args, 'P')) {
|
if (!args_has(args, 'P')) {
|
||||||
if (*prefix != KEYC_NONE)
|
if (*prefix != KEYC_NONE)
|
||||||
xasprintf(&s, "%s ", key_string_lookup_key(*prefix));
|
xasprintf(&s, "%s ", key_string_lookup_key(*prefix, 0));
|
||||||
else
|
else
|
||||||
s = xstrdup("");
|
s = xstrdup("");
|
||||||
} else
|
} else
|
||||||
@ -221,7 +221,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
bd = key_bindings_next(table, bd);
|
bd = key_bindings_next(table, bd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
key = args_escape(key_string_lookup_key(bd->key));
|
key = args_escape(key_string_lookup_key(bd->key, 0));
|
||||||
|
|
||||||
if (bd->flags & KEY_BINDING_REPEAT)
|
if (bd->flags & KEY_BINDING_REPEAT)
|
||||||
repeat = 1;
|
repeat = 1;
|
||||||
@ -255,7 +255,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
found = 1;
|
found = 1;
|
||||||
key = args_escape(key_string_lookup_key(bd->key));
|
key = args_escape(key_string_lookup_key(bd->key, 0));
|
||||||
|
|
||||||
if (!repeat)
|
if (!repeat)
|
||||||
r = "";
|
r = "";
|
||||||
|
@ -547,7 +547,7 @@ cmdq_add_message(struct cmdq_item *item)
|
|||||||
if (c != NULL) {
|
if (c != NULL) {
|
||||||
name = c->name;
|
name = c->name;
|
||||||
if (c->session != NULL && state->event.key != KEYC_NONE) {
|
if (c->session != NULL && state->event.key != KEYC_NONE) {
|
||||||
key = key_string_lookup_key(state->event.key);
|
key = key_string_lookup_key(state->event.key, 0);
|
||||||
server_add_message("%s key %s: %s", name, key, tmp);
|
server_add_message("%s key %s: %s", name, key, tmp);
|
||||||
} else
|
} else
|
||||||
server_add_message("%s command: %s", name, tmp);
|
server_add_message("%s command: %s", name, tmp);
|
||||||
|
@ -71,13 +71,13 @@ cmd_send_keys_inject_key(struct cmdq_item *item, struct cmdq_item *after,
|
|||||||
|
|
||||||
wme = TAILQ_FIRST(&wp->modes);
|
wme = TAILQ_FIRST(&wp->modes);
|
||||||
if (wme == NULL || wme->mode->key_table == NULL) {
|
if (wme == NULL || wme->mode->key_table == NULL) {
|
||||||
if (window_pane_key(wp, tc, s, wl, key|KEYC_XTERM, NULL) != 0)
|
if (window_pane_key(wp, tc, s, wl, key, NULL) != 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
return (item);
|
return (item);
|
||||||
}
|
}
|
||||||
table = key_bindings_get_table(wme->mode->key_table(wme), 1);
|
table = key_bindings_get_table(wme->mode->key_table(wme), 1);
|
||||||
|
|
||||||
bd = key_bindings_get(table, key & ~KEYC_XTERM);
|
bd = key_bindings_get(table, key & ~KEYC_MASK_FLAGS);
|
||||||
if (bd != NULL) {
|
if (bd != NULL) {
|
||||||
table->references++;
|
table->references++;
|
||||||
after = key_bindings_dispatch(bd, after, tc, NULL, target);
|
after = key_bindings_dispatch(bd, after, tc, NULL, target);
|
||||||
|
91
input-keys.c
91
input-keys.c
@ -265,82 +265,82 @@ static struct input_key_entry input_key_defaults[] = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/* Keys with an embedded modifier. */
|
/* Keys with an embedded modifier. */
|
||||||
{ .key = KEYC_F1|KEYC_XTERM,
|
{ .key = KEYC_F1|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[1;_P"
|
.data = "\033[1;_P"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_F2|KEYC_XTERM,
|
{ .key = KEYC_F2|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[1;_Q"
|
.data = "\033[1;_Q"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_F3|KEYC_XTERM,
|
{ .key = KEYC_F3|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[1;_R"
|
.data = "\033[1;_R"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_F4|KEYC_XTERM,
|
{ .key = KEYC_F4|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[1;_S"
|
.data = "\033[1;_S"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_F5|KEYC_XTERM,
|
{ .key = KEYC_F5|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[15;_~"
|
.data = "\033[15;_~"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_F6|KEYC_XTERM,
|
{ .key = KEYC_F6|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[17;_~"
|
.data = "\033[17;_~"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_F7|KEYC_XTERM,
|
{ .key = KEYC_F7|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[18;_~"
|
.data = "\033[18;_~"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_F8|KEYC_XTERM,
|
{ .key = KEYC_F8|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[19;_~"
|
.data = "\033[19;_~"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_F9|KEYC_XTERM,
|
{ .key = KEYC_F9|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[20;_~"
|
.data = "\033[20;_~"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_F10|KEYC_XTERM,
|
{ .key = KEYC_F10|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[21;_~"
|
.data = "\033[21;_~"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_F11|KEYC_XTERM,
|
{ .key = KEYC_F11|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[23;_~"
|
.data = "\033[23;_~"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_F12|KEYC_XTERM,
|
{ .key = KEYC_F12|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[24;_~"
|
.data = "\033[24;_~"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_UP|KEYC_XTERM,
|
{ .key = KEYC_UP|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[1;_A"
|
.data = "\033[1;_A"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_DOWN|KEYC_XTERM,
|
{ .key = KEYC_DOWN|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[1;_B"
|
.data = "\033[1;_B"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_RIGHT|KEYC_XTERM,
|
{ .key = KEYC_RIGHT|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[1;_C"
|
.data = "\033[1;_C"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_LEFT|KEYC_XTERM,
|
{ .key = KEYC_LEFT|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[1;_D"
|
.data = "\033[1;_D"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_HOME|KEYC_XTERM,
|
{ .key = KEYC_HOME|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[1;_H"
|
.data = "\033[1;_H"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_END|KEYC_XTERM,
|
{ .key = KEYC_END|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[1;_F"
|
.data = "\033[1;_F"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_PPAGE|KEYC_XTERM,
|
{ .key = KEYC_PPAGE|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[5;_~"
|
.data = "\033[5;_~"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_NPAGE|KEYC_XTERM,
|
{ .key = KEYC_NPAGE|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[6;_~"
|
.data = "\033[6;_~"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_IC|KEYC_XTERM,
|
{ .key = KEYC_IC|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[2;_~"
|
.data = "\033[2;_~"
|
||||||
},
|
},
|
||||||
{ .key = KEYC_DC|KEYC_XTERM,
|
{ .key = KEYC_DC|KEYC_BUILD_MODIFIERS,
|
||||||
.data = "\033[3;_~" }
|
.data = "\033[3;_~" }
|
||||||
};
|
};
|
||||||
static const key_code input_key_modifiers[] = {
|
static const key_code input_key_modifiers[] = {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
KEYC_SHIFT|KEYC_XTERM,
|
KEYC_SHIFT,
|
||||||
KEYC_META|KEYC_XTERM,
|
KEYC_META|KEYC_IMPLIED_META,
|
||||||
KEYC_SHIFT|KEYC_META|KEYC_XTERM,
|
KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META,
|
||||||
KEYC_CTRL|KEYC_XTERM,
|
KEYC_CTRL,
|
||||||
KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM,
|
KEYC_SHIFT|KEYC_CTRL,
|
||||||
KEYC_META|KEYC_CTRL|KEYC_XTERM,
|
KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL,
|
||||||
KEYC_SHIFT|KEYC_META|KEYC_CTRL|KEYC_XTERM
|
KEYC_SHIFT|KEYC_META|KEYC_CTRL
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Input key comparison function. */
|
/* Input key comparison function. */
|
||||||
@ -354,6 +354,15 @@ input_key_cmp(struct input_key_entry *ike1, struct input_key_entry *ike2)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Look for key in tree. */
|
||||||
|
static struct input_key_entry *
|
||||||
|
input_key_get (key_code key)
|
||||||
|
{
|
||||||
|
struct input_key_entry entry = { .key = key };
|
||||||
|
|
||||||
|
return (RB_FIND(input_key_tree, &input_key_tree, &entry));
|
||||||
|
}
|
||||||
|
|
||||||
/* Split a character into two UTF-8 bytes. */
|
/* Split a character into two UTF-8 bytes. */
|
||||||
static size_t
|
static size_t
|
||||||
input_key_split2(u_int c, u_char *dst)
|
input_key_split2(u_int c, u_char *dst)
|
||||||
@ -374,20 +383,22 @@ input_key_build(void)
|
|||||||
struct input_key_entry *ike, *new;
|
struct input_key_entry *ike, *new;
|
||||||
u_int i, j;
|
u_int i, j;
|
||||||
char *data;
|
char *data;
|
||||||
|
key_code key;
|
||||||
|
|
||||||
for (i = 0; i < nitems(input_key_defaults); i++) {
|
for (i = 0; i < nitems(input_key_defaults); i++) {
|
||||||
ike = &input_key_defaults[i];
|
ike = &input_key_defaults[i];
|
||||||
if (~ike->key & KEYC_XTERM) {
|
if (~ike->key & KEYC_BUILD_MODIFIERS) {
|
||||||
RB_INSERT(input_key_tree, &input_key_tree, ike);
|
RB_INSERT(input_key_tree, &input_key_tree, ike);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 2; j < nitems(input_key_modifiers); j++) {
|
for (j = 2; j < nitems(input_key_modifiers); j++) {
|
||||||
|
key = (ike->key & ~KEYC_BUILD_MODIFIERS);
|
||||||
data = xstrdup(ike->data);
|
data = xstrdup(ike->data);
|
||||||
data[strcspn(data, "_")] = '0' + j;
|
data[strcspn(data, "_")] = '0' + j;
|
||||||
|
|
||||||
new = xcalloc(1, sizeof *new);
|
new = xcalloc(1, sizeof *new);
|
||||||
new->key = ike->key|input_key_modifiers[j];
|
new->key = key|input_key_modifiers[j];
|
||||||
new->data = data;
|
new->data = data;
|
||||||
RB_INSERT(input_key_tree, &input_key_tree, new);
|
RB_INSERT(input_key_tree, &input_key_tree, new);
|
||||||
}
|
}
|
||||||
@ -395,7 +406,7 @@ input_key_build(void)
|
|||||||
|
|
||||||
RB_FOREACH(ike, input_key_tree, &input_key_tree) {
|
RB_FOREACH(ike, input_key_tree, &input_key_tree) {
|
||||||
log_debug("%s: 0x%llx (%s) is %s", __func__, ike->key,
|
log_debug("%s: 0x%llx (%s) is %s", __func__, ike->key,
|
||||||
key_string_lookup_key(ike->key), ike->data);
|
key_string_lookup_key(ike->key, 1), ike->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,7 +416,7 @@ input_key_pane(struct window_pane *wp, key_code key, struct mouse_event *m)
|
|||||||
{
|
{
|
||||||
if (log_get_level() != 0) {
|
if (log_get_level() != 0) {
|
||||||
log_debug("writing key 0x%llx (%s) to %%%u", key,
|
log_debug("writing key 0x%llx (%s) to %%%u", key,
|
||||||
key_string_lookup_key(key), wp->id);
|
key_string_lookup_key(key, 1), wp->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KEYC_IS_MOUSE(key)) {
|
if (KEYC_IS_MOUSE(key)) {
|
||||||
@ -420,7 +431,7 @@ input_key_pane(struct window_pane *wp, key_code key, struct mouse_event *m)
|
|||||||
int
|
int
|
||||||
input_key(struct screen *s, struct bufferevent *bev, key_code key)
|
input_key(struct screen *s, struct bufferevent *bev, key_code key)
|
||||||
{
|
{
|
||||||
struct input_key_entry *ike, entry;
|
struct input_key_entry *ike;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
key_code justkey, newkey;
|
key_code justkey, newkey;
|
||||||
struct utf8_data ud;
|
struct utf8_data ud;
|
||||||
@ -441,14 +452,14 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
|
|||||||
newkey = options_get_number(global_options, "backspace");
|
newkey = options_get_number(global_options, "backspace");
|
||||||
if (newkey >= 0x7f)
|
if (newkey >= 0x7f)
|
||||||
newkey = '\177';
|
newkey = '\177';
|
||||||
key = newkey|(key & KEYC_MASK_MOD);
|
key = newkey|(key & (KEYC_MASK_MODIFIERS|KEYC_MASK_FLAGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is a normal 7-bit key, just send it, with a leading escape
|
* If this is a normal 7-bit key, just send it, with a leading escape
|
||||||
* if necessary. If it is a UTF-8 key, split it and send it.
|
* if necessary. If it is a UTF-8 key, split it and send it.
|
||||||
*/
|
*/
|
||||||
justkey = (key & ~(KEYC_XTERM|KEYC_META));
|
justkey = (key & ~KEYC_META);
|
||||||
if (justkey <= 0x7f) {
|
if (justkey <= 0x7f) {
|
||||||
if (key & KEYC_META)
|
if (key & KEYC_META)
|
||||||
bufferevent_write(bev, "\033", 1);
|
bufferevent_write(bev, "\033", 1);
|
||||||
@ -473,8 +484,10 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
|
|||||||
key &= ~KEYC_KEYPAD;
|
key &= ~KEYC_KEYPAD;
|
||||||
if (~s->mode & MODE_KCURSOR)
|
if (~s->mode & MODE_KCURSOR)
|
||||||
key &= ~KEYC_CURSOR;
|
key &= ~KEYC_CURSOR;
|
||||||
entry.key = key;
|
ike = input_key_get(key);
|
||||||
if ((ike = RB_FIND(input_key_tree, &input_key_tree, &entry)) == NULL) {
|
if (ike == NULL && (key & KEYC_META) && (~key & KEYC_IMPLIED_META))
|
||||||
|
ike = input_key_get(key & ~KEYC_META);
|
||||||
|
if (ike == NULL) {
|
||||||
log_debug("key 0x%llx missing", key);
|
log_debug("key 0x%llx missing", key);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -482,7 +495,7 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
|
|||||||
log_debug("found key 0x%llx: \"%s\"", key, ike->data);
|
log_debug("found key 0x%llx: \"%s\"", key, ike->data);
|
||||||
|
|
||||||
/* Prefix a \033 for escape. */
|
/* Prefix a \033 for escape. */
|
||||||
if (key & KEYC_META)
|
if (key & KEYC_META && (~key & KEYC_IMPLIED_META))
|
||||||
bufferevent_write(bev, "\033", 1);
|
bufferevent_write(bev, "\033", 1);
|
||||||
bufferevent_write(bev, ike->data, datalen);
|
bufferevent_write(bev, ike->data, datalen);
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -190,7 +190,7 @@ key_bindings_add(const char *name, key_code key, const char *note, int repeat,
|
|||||||
|
|
||||||
table = key_bindings_get_table(name, 1);
|
table = key_bindings_get_table(name, 1);
|
||||||
|
|
||||||
bd = key_bindings_get(table, key & ~KEYC_XTERM);
|
bd = key_bindings_get(table, key & ~KEYC_MASK_FLAGS);
|
||||||
if (bd != NULL) {
|
if (bd != NULL) {
|
||||||
RB_REMOVE(key_bindings, &table->key_bindings, bd);
|
RB_REMOVE(key_bindings, &table->key_bindings, bd);
|
||||||
key_bindings_free(bd);
|
key_bindings_free(bd);
|
||||||
@ -217,7 +217,7 @@ key_bindings_remove(const char *name, key_code key)
|
|||||||
if (table == NULL)
|
if (table == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bd = key_bindings_get(table, key & ~KEYC_XTERM);
|
bd = key_bindings_get(table, key & ~KEYC_MASK_FLAGS);
|
||||||
if (bd == NULL)
|
if (bd == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
47
key-string.c
47
key-string.c
@ -212,7 +212,7 @@ key_string_lookup_string(const char *string)
|
|||||||
return (KEYC_UNKNOWN);
|
return (KEYC_UNKNOWN);
|
||||||
if (utf8_combine(&ud, &wc) != UTF8_DONE)
|
if (utf8_combine(&ud, &wc) != UTF8_DONE)
|
||||||
return (KEYC_UNKNOWN);
|
return (KEYC_UNKNOWN);
|
||||||
return (wc | modifiers);
|
return (wc|modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise look the key up in the table. */
|
/* Otherwise look the key up in the table. */
|
||||||
@ -236,14 +236,15 @@ key_string_lookup_string(const char *string)
|
|||||||
modifiers &= ~KEYC_CTRL;
|
modifiers &= ~KEYC_CTRL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (key | modifiers);
|
return (key|modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert a key code into string format, with prefix if necessary. */
|
/* Convert a key code into string format, with prefix if necessary. */
|
||||||
const char *
|
const char *
|
||||||
key_string_lookup_key(key_code key)
|
key_string_lookup_key(key_code key, int with_flags)
|
||||||
{
|
{
|
||||||
static char out[32];
|
key_code saved = key;
|
||||||
|
static char out[64];
|
||||||
char tmp[8];
|
char tmp[8];
|
||||||
const char *s;
|
const char *s;
|
||||||
u_int i;
|
u_int i;
|
||||||
@ -255,12 +256,12 @@ key_string_lookup_key(key_code key)
|
|||||||
/* Literal keys are themselves. */
|
/* Literal keys are themselves. */
|
||||||
if (key & KEYC_LITERAL) {
|
if (key & KEYC_LITERAL) {
|
||||||
snprintf(out, sizeof out, "%c", (int)(key & 0xff));
|
snprintf(out, sizeof out, "%c", (int)(key & 0xff));
|
||||||
return (out);
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display C-@ as C-Space. */
|
/* Display C-@ as C-Space. */
|
||||||
if ((key & KEYC_MASK_KEY) == 0)
|
if ((key & (KEYC_MASK_KEY|KEYC_MASK_MODIFIERS)) == 0)
|
||||||
key = ' ' | KEYC_CTRL | (key & KEYC_MASK_MOD);
|
key = ' '|KEYC_CTRL;
|
||||||
|
|
||||||
/* Fill in the modifiers. */
|
/* Fill in the modifiers. */
|
||||||
if (key & KEYC_CTRL)
|
if (key & KEYC_CTRL)
|
||||||
@ -272,8 +273,10 @@ key_string_lookup_key(key_code key)
|
|||||||
key &= KEYC_MASK_KEY;
|
key &= KEYC_MASK_KEY;
|
||||||
|
|
||||||
/* Handle no key. */
|
/* Handle no key. */
|
||||||
if (key == KEYC_NONE)
|
if (key == KEYC_NONE) {
|
||||||
return ("None");
|
s = "None";
|
||||||
|
goto append;
|
||||||
|
}
|
||||||
|
|
||||||
/* Handle special keys. */
|
/* Handle special keys. */
|
||||||
if (key == KEYC_UNKNOWN) {
|
if (key == KEYC_UNKNOWN) {
|
||||||
@ -331,7 +334,7 @@ key_string_lookup_key(key_code key)
|
|||||||
if (key >= KEYC_USER && key < KEYC_USER + KEYC_NUSER) {
|
if (key >= KEYC_USER && key < KEYC_USER + KEYC_NUSER) {
|
||||||
snprintf(tmp, sizeof tmp, "User%u", (u_int)(key - KEYC_USER));
|
snprintf(tmp, sizeof tmp, "User%u", (u_int)(key - KEYC_USER));
|
||||||
strlcat(out, tmp, sizeof out);
|
strlcat(out, tmp, sizeof out);
|
||||||
return (out);
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try the key against the string table. */
|
/* Try the key against the string table. */
|
||||||
@ -341,7 +344,7 @@ key_string_lookup_key(key_code key)
|
|||||||
}
|
}
|
||||||
if (i != nitems(key_string_table)) {
|
if (i != nitems(key_string_table)) {
|
||||||
strlcat(out, key_string_table[i].string, sizeof out);
|
strlcat(out, key_string_table[i].string, sizeof out);
|
||||||
return (out);
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is this a UTF-8 key? */
|
/* Is this a UTF-8 key? */
|
||||||
@ -350,14 +353,14 @@ key_string_lookup_key(key_code key)
|
|||||||
off = strlen(out);
|
off = strlen(out);
|
||||||
memcpy(out + off, ud.data, ud.size);
|
memcpy(out + off, ud.data, ud.size);
|
||||||
out[off + ud.size] = '\0';
|
out[off + ud.size] = '\0';
|
||||||
return (out);
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invalid keys are errors. */
|
/* Invalid keys are errors. */
|
||||||
if (key > 255) {
|
if (key > 255) {
|
||||||
snprintf(out, sizeof out, "Invalid#%llx", key);
|
snprintf(out, sizeof out, "Invalid#%llx", key);
|
||||||
return (out);
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for standard or control key. */
|
/* Check for standard or control key. */
|
||||||
@ -375,9 +378,25 @@ key_string_lookup_key(key_code key)
|
|||||||
xsnprintf(tmp, sizeof tmp, "\\%llo", key);
|
xsnprintf(tmp, sizeof tmp, "\\%llo", key);
|
||||||
|
|
||||||
strlcat(out, tmp, sizeof out);
|
strlcat(out, tmp, sizeof out);
|
||||||
return (out);
|
goto out;
|
||||||
|
|
||||||
append:
|
append:
|
||||||
strlcat(out, s, sizeof out);
|
strlcat(out, s, sizeof out);
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (with_flags && (saved & KEYC_MASK_FLAGS) != 0) {
|
||||||
|
strlcat(out, "[", sizeof out);
|
||||||
|
if (saved & KEYC_LITERAL)
|
||||||
|
strlcat(out, "L", sizeof out);
|
||||||
|
if (saved & KEYC_KEYPAD)
|
||||||
|
strlcat(out, "K", sizeof out);
|
||||||
|
if (saved & KEYC_CURSOR)
|
||||||
|
strlcat(out, "C", sizeof out);
|
||||||
|
if (saved & KEYC_IMPLIED_META)
|
||||||
|
strlcat(out, "I", sizeof out);
|
||||||
|
if (saved & KEYC_BUILD_MODIFIERS)
|
||||||
|
strlcat(out, "B", sizeof out);
|
||||||
|
strlcat(out, "]", sizeof out);
|
||||||
|
}
|
||||||
return (out);
|
return (out);
|
||||||
}
|
}
|
||||||
|
2
menu.c
2
menu.c
@ -81,7 +81,7 @@ menu_add_item(struct menu *menu, const struct menu_item *item,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (*s != '-' && item->key != KEYC_UNKNOWN && item->key != KEYC_NONE) {
|
if (*s != '-' && item->key != KEYC_UNKNOWN && item->key != KEYC_NONE) {
|
||||||
key = key_string_lookup_key(item->key);
|
key = key_string_lookup_key(item->key, 0);
|
||||||
xasprintf(&name, "%s#[default] #[align=right](%s)", s, key);
|
xasprintf(&name, "%s#[default] #[align=right](%s)", s, key);
|
||||||
} else
|
} else
|
||||||
xasprintf(&name, "%s", s);
|
xasprintf(&name, "%s", s);
|
||||||
|
@ -987,7 +987,7 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
|
|||||||
choice = -1;
|
choice = -1;
|
||||||
if (*key >= '0' && *key <= '9')
|
if (*key >= '0' && *key <= '9')
|
||||||
choice = (*key) - '0';
|
choice = (*key) - '0';
|
||||||
else if (((*key) & KEYC_MASK_MOD) == KEYC_META) {
|
else if (((*key) & KEYC_MASK_MODIFIERS) == KEYC_META) {
|
||||||
tmp = (*key) & KEYC_MASK_KEY;
|
tmp = (*key) & KEYC_MASK_KEY;
|
||||||
if (tmp >= 'a' && tmp <= 'z')
|
if (tmp >= 'a' && tmp <= 'z')
|
||||||
choice = 10 + (tmp - 'a');
|
choice = 10 + (tmp - 'a');
|
||||||
|
@ -129,7 +129,7 @@ options_value_to_string(struct options_entry *o, union options_value *ov,
|
|||||||
xasprintf(&s, "%lld", ov->number);
|
xasprintf(&s, "%lld", ov->number);
|
||||||
break;
|
break;
|
||||||
case OPTIONS_TABLE_KEY:
|
case OPTIONS_TABLE_KEY:
|
||||||
s = xstrdup(key_string_lookup_key(ov->number));
|
s = xstrdup(key_string_lookup_key(ov->number, 0));
|
||||||
break;
|
break;
|
||||||
case OPTIONS_TABLE_COLOUR:
|
case OPTIONS_TABLE_COLOUR:
|
||||||
s = xstrdup(colour_tostring(ov->number));
|
s = xstrdup(colour_tostring(ov->number));
|
||||||
@ -282,7 +282,7 @@ options_default_to_string(const struct options_table_entry *oe)
|
|||||||
xasprintf(&s, "%lld", oe->default_num);
|
xasprintf(&s, "%lld", oe->default_num);
|
||||||
break;
|
break;
|
||||||
case OPTIONS_TABLE_KEY:
|
case OPTIONS_TABLE_KEY:
|
||||||
s = xstrdup(key_string_lookup_key(oe->default_num));
|
s = xstrdup(key_string_lookup_key(oe->default_num, 0));
|
||||||
break;
|
break;
|
||||||
case OPTIONS_TABLE_COLOUR:
|
case OPTIONS_TABLE_COLOUR:
|
||||||
s = xstrdup(colour_tostring(oe->default_num));
|
s = xstrdup(colour_tostring(oe->default_num));
|
||||||
|
2
popup.c
2
popup.c
@ -340,7 +340,7 @@ popup_key_cb(struct client *c, struct key_event *event)
|
|||||||
format_defaults(ft, c, fs->s, fs->wl, fs->wp);
|
format_defaults(ft, c, fs->s, fs->wl, fs->wp);
|
||||||
else
|
else
|
||||||
format_defaults(ft, c, NULL, NULL, NULL);
|
format_defaults(ft, c, NULL, NULL, NULL);
|
||||||
format_add(ft, "popup_key", "%s", key_string_lookup_key(event->key));
|
format_add(ft, "popup_key", "%s", key_string_lookup_key(event->key, 0));
|
||||||
if (KEYC_IS_MOUSE(event->key)) {
|
if (KEYC_IS_MOUSE(event->key)) {
|
||||||
format_add(ft, "popup_mouse", "1");
|
format_add(ft, "popup_mouse", "1");
|
||||||
format_add(ft, "popup_mouse_x", "%u", m->x - pd->px);
|
format_add(ft, "popup_mouse_x", "%u", m->x - pd->px);
|
||||||
|
@ -1040,7 +1040,7 @@ out:
|
|||||||
key |= KEYC_SHIFT;
|
key |= KEYC_SHIFT;
|
||||||
|
|
||||||
if (log_get_level() != 0)
|
if (log_get_level() != 0)
|
||||||
log_debug("mouse key is %s", key_string_lookup_key (key));
|
log_debug("mouse key is %s", key_string_lookup_key (key, 1));
|
||||||
return (key);
|
return (key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1172,7 +1172,7 @@ table_changed:
|
|||||||
* The prefix always takes precedence and forces a switch to the prefix
|
* The prefix always takes precedence and forces a switch to the prefix
|
||||||
* table, unless we are already there.
|
* table, unless we are already there.
|
||||||
*/
|
*/
|
||||||
key0 = (key & ~KEYC_XTERM);
|
key0 = (key & (KEYC_MASK_KEY|KEYC_MASK_MODIFIERS));
|
||||||
if ((key0 == (key_code)options_get_number(s->options, "prefix") ||
|
if ((key0 == (key_code)options_get_number(s->options, "prefix") ||
|
||||||
key0 == (key_code)options_get_number(s->options, "prefix2")) &&
|
key0 == (key_code)options_get_number(s->options, "prefix2")) &&
|
||||||
strcmp(table->name, "prefix") != 0) {
|
strcmp(table->name, "prefix") != 0) {
|
||||||
|
4
status.c
4
status.c
@ -1023,7 +1023,7 @@ status_prompt_key(struct client *c, key_code key)
|
|||||||
int keys;
|
int keys;
|
||||||
|
|
||||||
if (c->prompt_flags & PROMPT_KEY) {
|
if (c->prompt_flags & PROMPT_KEY) {
|
||||||
keystring = key_string_lookup_key(key);
|
keystring = key_string_lookup_key(key, 0);
|
||||||
c->prompt_inputcb(c, c->prompt_data, keystring, 1);
|
c->prompt_inputcb(c, c->prompt_data, keystring, 1);
|
||||||
status_prompt_clear(c);
|
status_prompt_clear(c);
|
||||||
return (0);
|
return (0);
|
||||||
@ -1039,7 +1039,7 @@ status_prompt_key(struct client *c, key_code key)
|
|||||||
free(s);
|
free(s);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
key &= ~KEYC_XTERM;
|
key &= ~KEYC_MASK_FLAGS;
|
||||||
|
|
||||||
keys = options_get_number(c->session->options, "status-keys");
|
keys = options_get_number(c->session->options, "status-keys");
|
||||||
if (keys == MODEKEY_VI) {
|
if (keys == MODEKEY_VI) {
|
||||||
|
28
tmux.h
28
tmux.h
@ -120,21 +120,25 @@ struct winlink;
|
|||||||
#define KEYC_USER 0x0002000000000ULL
|
#define KEYC_USER 0x0002000000000ULL
|
||||||
|
|
||||||
/* Key modifier bits. */
|
/* Key modifier bits. */
|
||||||
#define KEYC_META 0x0100000000000ULL
|
#define KEYC_META 0x00100000000000ULL
|
||||||
#define KEYC_CTRL 0x0200000000000ULL
|
#define KEYC_CTRL 0x00200000000000ULL
|
||||||
#define KEYC_SHIFT 0x0400000000000ULL
|
#define KEYC_SHIFT 0x00400000000000ULL
|
||||||
#define KEYC_XTERM 0x0800000000000ULL
|
|
||||||
#define KEYC_LITERAL 0x1000000000000ULL
|
/* Key flag bits. */
|
||||||
#define KEYC_KEYPAD 0x2000000000000ULL
|
#define KEYC_LITERAL 0x01000000000000ULL
|
||||||
#define KEYC_CURSOR 0x4000000000000ULL
|
#define KEYC_KEYPAD 0x02000000000000ULL
|
||||||
|
#define KEYC_CURSOR 0x04000000000000ULL
|
||||||
|
#define KEYC_IMPLIED_META 0x08000000000000ULL
|
||||||
|
#define KEYC_BUILD_MODIFIERS 0x10000000000000ULL
|
||||||
|
|
||||||
|
/* Masks for key bits. */
|
||||||
|
#define KEYC_MASK_MODIFIERS 0x00f00000000000ULL
|
||||||
|
#define KEYC_MASK_FLAGS 0xff000000000000ULL
|
||||||
|
#define KEYC_MASK_KEY 0x000fffffffffffULL
|
||||||
|
|
||||||
/* Available user keys. */
|
/* Available user keys. */
|
||||||
#define KEYC_NUSER 1000
|
#define KEYC_NUSER 1000
|
||||||
|
|
||||||
/* Mask to obtain key w/o modifiers. */
|
|
||||||
#define KEYC_MASK_MOD 0xff00000000000ULL
|
|
||||||
#define KEYC_MASK_KEY 0x00fffffffffffULL
|
|
||||||
|
|
||||||
/* Is this a mouse key? */
|
/* Is this a mouse key? */
|
||||||
#define KEYC_IS_MOUSE(key) (((key) & KEYC_MASK_KEY) >= KEYC_MOUSE && \
|
#define KEYC_IS_MOUSE(key) (((key) & KEYC_MASK_KEY) >= KEYC_MOUSE && \
|
||||||
((key) & KEYC_MASK_KEY) < KEYC_BSPACE)
|
((key) & KEYC_MASK_KEY) < KEYC_BSPACE)
|
||||||
@ -2286,7 +2290,7 @@ struct cmdq_item *key_bindings_dispatch(struct key_binding *,
|
|||||||
|
|
||||||
/* key-string.c */
|
/* key-string.c */
|
||||||
key_code key_string_lookup_string(const char *);
|
key_code key_string_lookup_string(const char *);
|
||||||
const char *key_string_lookup_key(key_code);
|
const char *key_string_lookup_key(key_code, int);
|
||||||
|
|
||||||
/* alerts.c */
|
/* alerts.c */
|
||||||
void alerts_reset_all(void);
|
void alerts_reset_all(void);
|
||||||
|
256
tty-keys.c
256
tty-keys.c
@ -225,13 +225,13 @@ static const struct tty_default_key_xterm tty_default_xterm_keys[] = {
|
|||||||
static const key_code tty_default_xterm_modifiers[] = {
|
static const key_code tty_default_xterm_modifiers[] = {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
KEYC_SHIFT|KEYC_XTERM,
|
KEYC_SHIFT,
|
||||||
KEYC_META|KEYC_XTERM,
|
KEYC_META|KEYC_IMPLIED_META,
|
||||||
KEYC_SHIFT|KEYC_META|KEYC_XTERM,
|
KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META,
|
||||||
KEYC_CTRL|KEYC_XTERM,
|
KEYC_CTRL,
|
||||||
KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM,
|
KEYC_SHIFT|KEYC_CTRL,
|
||||||
KEYC_META|KEYC_CTRL|KEYC_XTERM,
|
KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL,
|
||||||
KEYC_SHIFT|KEYC_META|KEYC_CTRL|KEYC_XTERM
|
KEYC_SHIFT|KEYC_META|KEYC_CTRL
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -258,61 +258,61 @@ static const struct tty_default_key_code tty_default_code_keys[] = {
|
|||||||
{ TTYC_KF11, KEYC_F11 },
|
{ TTYC_KF11, KEYC_F11 },
|
||||||
{ TTYC_KF12, KEYC_F12 },
|
{ TTYC_KF12, KEYC_F12 },
|
||||||
|
|
||||||
{ TTYC_KF13, KEYC_F1|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF13, KEYC_F1|KEYC_SHIFT },
|
||||||
{ TTYC_KF14, KEYC_F2|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF14, KEYC_F2|KEYC_SHIFT },
|
||||||
{ TTYC_KF15, KEYC_F3|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF15, KEYC_F3|KEYC_SHIFT },
|
||||||
{ TTYC_KF16, KEYC_F4|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF16, KEYC_F4|KEYC_SHIFT },
|
||||||
{ TTYC_KF17, KEYC_F5|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF17, KEYC_F5|KEYC_SHIFT },
|
||||||
{ TTYC_KF18, KEYC_F6|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF18, KEYC_F6|KEYC_SHIFT },
|
||||||
{ TTYC_KF19, KEYC_F7|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF19, KEYC_F7|KEYC_SHIFT },
|
||||||
{ TTYC_KF20, KEYC_F8|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF20, KEYC_F8|KEYC_SHIFT },
|
||||||
{ TTYC_KF21, KEYC_F9|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF21, KEYC_F9|KEYC_SHIFT },
|
||||||
{ TTYC_KF22, KEYC_F10|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF22, KEYC_F10|KEYC_SHIFT },
|
||||||
{ TTYC_KF23, KEYC_F11|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF23, KEYC_F11|KEYC_SHIFT },
|
||||||
{ TTYC_KF24, KEYC_F12|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF24, KEYC_F12|KEYC_SHIFT },
|
||||||
|
|
||||||
{ TTYC_KF25, KEYC_F1|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF25, KEYC_F1|KEYC_CTRL },
|
||||||
{ TTYC_KF26, KEYC_F2|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF26, KEYC_F2|KEYC_CTRL },
|
||||||
{ TTYC_KF27, KEYC_F3|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF27, KEYC_F3|KEYC_CTRL },
|
||||||
{ TTYC_KF28, KEYC_F4|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF28, KEYC_F4|KEYC_CTRL },
|
||||||
{ TTYC_KF29, KEYC_F5|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF29, KEYC_F5|KEYC_CTRL },
|
||||||
{ TTYC_KF30, KEYC_F6|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF30, KEYC_F6|KEYC_CTRL },
|
||||||
{ TTYC_KF31, KEYC_F7|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF31, KEYC_F7|KEYC_CTRL },
|
||||||
{ TTYC_KF32, KEYC_F8|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF32, KEYC_F8|KEYC_CTRL },
|
||||||
{ TTYC_KF33, KEYC_F9|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF33, KEYC_F9|KEYC_CTRL },
|
||||||
{ TTYC_KF34, KEYC_F10|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF34, KEYC_F10|KEYC_CTRL },
|
||||||
{ TTYC_KF35, KEYC_F11|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF35, KEYC_F11|KEYC_CTRL },
|
||||||
{ TTYC_KF36, KEYC_F12|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF36, KEYC_F12|KEYC_CTRL },
|
||||||
|
|
||||||
{ TTYC_KF37, KEYC_F1|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF37, KEYC_F1|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KF38, KEYC_F2|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF38, KEYC_F2|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KF39, KEYC_F3|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF39, KEYC_F3|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KF40, KEYC_F4|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF40, KEYC_F4|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KF41, KEYC_F5|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF41, KEYC_F5|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KF42, KEYC_F6|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF42, KEYC_F6|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KF43, KEYC_F7|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF43, KEYC_F7|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KF44, KEYC_F8|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF44, KEYC_F8|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KF45, KEYC_F9|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF45, KEYC_F9|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KF46, KEYC_F10|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF46, KEYC_F10|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KF47, KEYC_F11|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF47, KEYC_F11|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KF48, KEYC_F12|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KF48, KEYC_F12|KEYC_SHIFT|KEYC_CTRL },
|
||||||
|
|
||||||
{ TTYC_KF49, KEYC_F1|KEYC_META|KEYC_XTERM },
|
{ TTYC_KF49, KEYC_F1|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KF50, KEYC_F2|KEYC_META|KEYC_XTERM },
|
{ TTYC_KF50, KEYC_F2|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KF51, KEYC_F3|KEYC_META|KEYC_XTERM },
|
{ TTYC_KF51, KEYC_F3|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KF52, KEYC_F4|KEYC_META|KEYC_XTERM },
|
{ TTYC_KF52, KEYC_F4|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KF53, KEYC_F5|KEYC_META|KEYC_XTERM },
|
{ TTYC_KF53, KEYC_F5|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KF54, KEYC_F6|KEYC_META|KEYC_XTERM },
|
{ TTYC_KF54, KEYC_F6|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KF55, KEYC_F7|KEYC_META|KEYC_XTERM },
|
{ TTYC_KF55, KEYC_F7|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KF56, KEYC_F8|KEYC_META|KEYC_XTERM },
|
{ TTYC_KF56, KEYC_F8|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KF57, KEYC_F9|KEYC_META|KEYC_XTERM },
|
{ TTYC_KF57, KEYC_F9|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KF58, KEYC_F10|KEYC_META|KEYC_XTERM },
|
{ TTYC_KF58, KEYC_F10|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KF59, KEYC_F11|KEYC_META|KEYC_XTERM },
|
{ TTYC_KF59, KEYC_F11|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KF60, KEYC_F12|KEYC_META|KEYC_XTERM },
|
{ TTYC_KF60, KEYC_F12|KEYC_META|KEYC_IMPLIED_META },
|
||||||
|
|
||||||
{ TTYC_KF61, KEYC_F1|KEYC_META|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF61, KEYC_F1|KEYC_META|KEYC_IMPLIED_META|KEYC_SHIFT },
|
||||||
{ TTYC_KF62, KEYC_F2|KEYC_META|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF62, KEYC_F2|KEYC_META|KEYC_IMPLIED_META|KEYC_SHIFT },
|
||||||
{ TTYC_KF63, KEYC_F3|KEYC_META|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KF63, KEYC_F3|KEYC_META|KEYC_IMPLIED_META|KEYC_SHIFT },
|
||||||
|
|
||||||
{ TTYC_KICH1, KEYC_IC },
|
{ TTYC_KICH1, KEYC_IC },
|
||||||
{ TTYC_KDCH1, KEYC_DC },
|
{ TTYC_KDCH1, KEYC_DC },
|
||||||
@ -329,68 +329,68 @@ static const struct tty_default_key_code tty_default_code_keys[] = {
|
|||||||
{ TTYC_KCUF1, KEYC_RIGHT|KEYC_CURSOR },
|
{ TTYC_KCUF1, KEYC_RIGHT|KEYC_CURSOR },
|
||||||
|
|
||||||
/* Key and modifier capabilities. */
|
/* Key and modifier capabilities. */
|
||||||
{ TTYC_KDC2, KEYC_DC|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KDC2, KEYC_DC|KEYC_SHIFT },
|
||||||
{ TTYC_KDC3, KEYC_DC|KEYC_META|KEYC_XTERM },
|
{ TTYC_KDC3, KEYC_DC|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KDC4, KEYC_DC|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
|
{ TTYC_KDC4, KEYC_DC|KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KDC5, KEYC_DC|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KDC5, KEYC_DC|KEYC_CTRL },
|
||||||
{ TTYC_KDC6, KEYC_DC|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KDC6, KEYC_DC|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KDC7, KEYC_DC|KEYC_META|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KDC7, KEYC_DC|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL },
|
||||||
{ TTYC_KIND, KEYC_DOWN|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KIND, KEYC_DOWN|KEYC_SHIFT },
|
||||||
{ TTYC_KDN2, KEYC_DOWN|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KDN2, KEYC_DOWN|KEYC_SHIFT },
|
||||||
{ TTYC_KDN3, KEYC_DOWN|KEYC_META|KEYC_XTERM },
|
{ TTYC_KDN3, KEYC_DOWN|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KDN4, KEYC_DOWN|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
|
{ TTYC_KDN4, KEYC_DOWN|KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KDN5, KEYC_DOWN|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KDN5, KEYC_DOWN|KEYC_CTRL },
|
||||||
{ TTYC_KDN6, KEYC_DOWN|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KDN6, KEYC_DOWN|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KDN7, KEYC_DOWN|KEYC_META|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KDN7, KEYC_DOWN|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL },
|
||||||
{ TTYC_KEND2, KEYC_END|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KEND2, KEYC_END|KEYC_SHIFT },
|
||||||
{ TTYC_KEND3, KEYC_END|KEYC_META|KEYC_XTERM },
|
{ TTYC_KEND3, KEYC_END|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KEND4, KEYC_END|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
|
{ TTYC_KEND4, KEYC_END|KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KEND5, KEYC_END|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KEND5, KEYC_END|KEYC_CTRL },
|
||||||
{ TTYC_KEND6, KEYC_END|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KEND6, KEYC_END|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KEND7, KEYC_END|KEYC_META|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KEND7, KEYC_END|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL },
|
||||||
{ TTYC_KHOM2, KEYC_HOME|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KHOM2, KEYC_HOME|KEYC_SHIFT },
|
||||||
{ TTYC_KHOM3, KEYC_HOME|KEYC_META|KEYC_XTERM },
|
{ TTYC_KHOM3, KEYC_HOME|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KHOM4, KEYC_HOME|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
|
{ TTYC_KHOM4, KEYC_HOME|KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KHOM5, KEYC_HOME|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KHOM5, KEYC_HOME|KEYC_CTRL },
|
||||||
{ TTYC_KHOM6, KEYC_HOME|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KHOM6, KEYC_HOME|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KHOM7, KEYC_HOME|KEYC_META|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KHOM7, KEYC_HOME|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL },
|
||||||
{ TTYC_KIC2, KEYC_IC|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KIC2, KEYC_IC|KEYC_SHIFT },
|
||||||
{ TTYC_KIC3, KEYC_IC|KEYC_META|KEYC_XTERM },
|
{ TTYC_KIC3, KEYC_IC|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KIC4, KEYC_IC|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
|
{ TTYC_KIC4, KEYC_IC|KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KIC5, KEYC_IC|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KIC5, KEYC_IC|KEYC_CTRL },
|
||||||
{ TTYC_KIC6, KEYC_IC|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KIC6, KEYC_IC|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KIC7, KEYC_IC|KEYC_META|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KIC7, KEYC_IC|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL },
|
||||||
{ TTYC_KLFT2, KEYC_LEFT|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KLFT2, KEYC_LEFT|KEYC_SHIFT },
|
||||||
{ TTYC_KLFT3, KEYC_LEFT|KEYC_META|KEYC_XTERM },
|
{ TTYC_KLFT3, KEYC_LEFT|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KLFT4, KEYC_LEFT|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
|
{ TTYC_KLFT4, KEYC_LEFT|KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KLFT5, KEYC_LEFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KLFT5, KEYC_LEFT|KEYC_CTRL },
|
||||||
{ TTYC_KLFT6, KEYC_LEFT|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KLFT6, KEYC_LEFT|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KLFT7, KEYC_LEFT|KEYC_META|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KLFT7, KEYC_LEFT|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL },
|
||||||
{ TTYC_KNXT2, KEYC_NPAGE|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KNXT2, KEYC_NPAGE|KEYC_SHIFT },
|
||||||
{ TTYC_KNXT3, KEYC_NPAGE|KEYC_META|KEYC_XTERM },
|
{ TTYC_KNXT3, KEYC_NPAGE|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KNXT4, KEYC_NPAGE|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
|
{ TTYC_KNXT4, KEYC_NPAGE|KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KNXT5, KEYC_NPAGE|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KNXT5, KEYC_NPAGE|KEYC_CTRL },
|
||||||
{ TTYC_KNXT6, KEYC_NPAGE|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KNXT6, KEYC_NPAGE|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KNXT7, KEYC_NPAGE|KEYC_META|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KNXT7, KEYC_NPAGE|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL },
|
||||||
{ TTYC_KPRV2, KEYC_PPAGE|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KPRV2, KEYC_PPAGE|KEYC_SHIFT },
|
||||||
{ TTYC_KPRV3, KEYC_PPAGE|KEYC_META|KEYC_XTERM },
|
{ TTYC_KPRV3, KEYC_PPAGE|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KPRV4, KEYC_PPAGE|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
|
{ TTYC_KPRV4, KEYC_PPAGE|KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KPRV5, KEYC_PPAGE|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KPRV5, KEYC_PPAGE|KEYC_CTRL },
|
||||||
{ TTYC_KPRV6, KEYC_PPAGE|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KPRV6, KEYC_PPAGE|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KPRV7, KEYC_PPAGE|KEYC_META|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KPRV7, KEYC_PPAGE|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL },
|
||||||
{ TTYC_KRIT2, KEYC_RIGHT|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KRIT2, KEYC_RIGHT|KEYC_SHIFT },
|
||||||
{ TTYC_KRIT3, KEYC_RIGHT|KEYC_META|KEYC_XTERM },
|
{ TTYC_KRIT3, KEYC_RIGHT|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KRIT4, KEYC_RIGHT|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
|
{ TTYC_KRIT4, KEYC_RIGHT|KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KRIT5, KEYC_RIGHT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KRIT5, KEYC_RIGHT|KEYC_CTRL },
|
||||||
{ TTYC_KRIT6, KEYC_RIGHT|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KRIT6, KEYC_RIGHT|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KRIT7, KEYC_RIGHT|KEYC_META|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KRIT7, KEYC_RIGHT|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL },
|
||||||
{ TTYC_KRI, KEYC_UP|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KRI, KEYC_UP|KEYC_SHIFT },
|
||||||
{ TTYC_KUP2, KEYC_UP|KEYC_SHIFT|KEYC_XTERM },
|
{ TTYC_KUP2, KEYC_UP|KEYC_SHIFT },
|
||||||
{ TTYC_KUP3, KEYC_UP|KEYC_META|KEYC_XTERM },
|
{ TTYC_KUP3, KEYC_UP|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KUP4, KEYC_UP|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
|
{ TTYC_KUP4, KEYC_UP|KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META },
|
||||||
{ TTYC_KUP5, KEYC_UP|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KUP5, KEYC_UP|KEYC_CTRL },
|
||||||
{ TTYC_KUP6, KEYC_UP|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KUP6, KEYC_UP|KEYC_SHIFT|KEYC_CTRL },
|
||||||
{ TTYC_KUP7, KEYC_UP|KEYC_META|KEYC_CTRL|KEYC_XTERM },
|
{ TTYC_KUP7, KEYC_UP|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Add key to tree. */
|
/* Add key to tree. */
|
||||||
@ -401,7 +401,7 @@ tty_keys_add(struct tty *tty, const char *s, key_code key)
|
|||||||
size_t size;
|
size_t size;
|
||||||
const char *keystr;
|
const char *keystr;
|
||||||
|
|
||||||
keystr = key_string_lookup_key(key);
|
keystr = key_string_lookup_key(key, 1);
|
||||||
if ((tk = tty_keys_find(tty, s, strlen(s), &size)) == NULL) {
|
if ((tk = tty_keys_find(tty, s, strlen(s), &size)) == NULL) {
|
||||||
log_debug("new key %s: 0x%llx (%s)", s, key, keystr);
|
log_debug("new key %s: 0x%llx (%s)", s, key, keystr);
|
||||||
tty_keys_add1(&tty->key_tree, s, key);
|
tty_keys_add1(&tty->key_tree, s, key);
|
||||||
@ -719,7 +719,7 @@ first_key:
|
|||||||
/* Look for a key without the escape. */
|
/* Look for a key without the escape. */
|
||||||
n = tty_keys_next1(tty, buf + 1, len - 1, &key, &size, expired);
|
n = tty_keys_next1(tty, buf + 1, len - 1, &key, &size, expired);
|
||||||
if (n == 0) { /* found */
|
if (n == 0) { /* found */
|
||||||
if (key & KEYC_XTERM) {
|
if (key & KEYC_IMPLIED_META) {
|
||||||
/*
|
/*
|
||||||
* We want the escape key as well as the xterm
|
* We want the escape key as well as the xterm
|
||||||
* key, because the xterm sequence implicitly
|
* key, because the xterm sequence implicitly
|
||||||
@ -789,7 +789,7 @@ complete_key:
|
|||||||
*/
|
*/
|
||||||
bspace = tty->tio.c_cc[VERASE];
|
bspace = tty->tio.c_cc[VERASE];
|
||||||
if (bspace != _POSIX_VDISABLE && (key & KEYC_MASK_KEY) == bspace)
|
if (bspace != _POSIX_VDISABLE && (key & KEYC_MASK_KEY) == bspace)
|
||||||
key = (key & KEYC_MASK_MOD) | KEYC_BSPACE;
|
key = (key & KEYC_MASK_MODIFIERS)|KEYC_BSPACE;
|
||||||
|
|
||||||
/* Remove data from buffer. */
|
/* Remove data from buffer. */
|
||||||
evbuffer_drain(tty->in, size);
|
evbuffer_drain(tty->in, size);
|
||||||
@ -896,16 +896,16 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
|
|||||||
*size = end + 1;
|
*size = end + 1;
|
||||||
|
|
||||||
/* Store the key and modifiers. */
|
/* Store the key and modifiers. */
|
||||||
*key = number|KEYC_XTERM;
|
*key = number;
|
||||||
switch (modifiers) {
|
switch (modifiers) {
|
||||||
case 2:
|
case 2:
|
||||||
(*key) |= KEYC_SHIFT;
|
(*key) |= KEYC_SHIFT;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
(*key) |= KEYC_META;
|
(*key) |= (KEYC_META|KEYC_IMPLIED_META);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
(*key) |= (KEYC_SHIFT|KEYC_META);
|
(*key) |= (KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
(*key) |= KEYC_CTRL;
|
(*key) |= KEYC_CTRL;
|
||||||
@ -917,7 +917,7 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
|
|||||||
(*key) |= (KEYC_META|KEYC_CTRL);
|
(*key) |= (KEYC_META|KEYC_CTRL);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
(*key) |= (KEYC_SHIFT|KEYC_META|KEYC_CTRL);
|
(*key) |= (KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*key = KEYC_NONE;
|
*key = KEYC_NONE;
|
||||||
@ -925,7 +925,7 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
|
|||||||
}
|
}
|
||||||
if (log_get_level() != 0) {
|
if (log_get_level() != 0) {
|
||||||
log_debug("%s: extended key %.*s is %llx (%s)", c->name,
|
log_debug("%s: extended key %.*s is %llx (%s)", c->name,
|
||||||
(int)*size, buf, *key, key_string_lookup_key(*key));
|
(int)*size, buf, *key, key_string_lookup_key(*key, 1));
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ window_customize_build_keys(struct window_customize_modedata *data,
|
|||||||
|
|
||||||
bd = key_bindings_first(kt);
|
bd = key_bindings_first(kt);
|
||||||
while (bd != NULL) {
|
while (bd != NULL) {
|
||||||
format_add(ft, "key", "%s", key_string_lookup_key(bd->key));
|
format_add(ft, "key", "%s", key_string_lookup_key(bd->key, 0));
|
||||||
if (bd->note != NULL)
|
if (bd->note != NULL)
|
||||||
format_add(ft, "key_note", "%s", bd->note);
|
format_add(ft, "key_note", "%s", bd->note);
|
||||||
if (filter != NULL) {
|
if (filter != NULL) {
|
||||||
@ -1233,7 +1233,7 @@ window_customize_set_key(struct client *c,
|
|||||||
if (strcmp(s, "Repeat") == 0)
|
if (strcmp(s, "Repeat") == 0)
|
||||||
bd->flags ^= KEY_BINDING_REPEAT;
|
bd->flags ^= KEY_BINDING_REPEAT;
|
||||||
else if (strcmp(s, "Command") == 0) {
|
else if (strcmp(s, "Command") == 0) {
|
||||||
xasprintf(&prompt, "(%s) ", key_string_lookup_key(key));
|
xasprintf(&prompt, "(%s) ", key_string_lookup_key(key, 0));
|
||||||
value = cmd_list_print(bd->cmdlist, 0);
|
value = cmd_list_print(bd->cmdlist, 0);
|
||||||
|
|
||||||
new_item = xcalloc(1, sizeof *new_item);
|
new_item = xcalloc(1, sizeof *new_item);
|
||||||
@ -1250,7 +1250,7 @@ window_customize_set_key(struct client *c,
|
|||||||
free(prompt);
|
free(prompt);
|
||||||
free(value);
|
free(value);
|
||||||
} else if (strcmp(s, "Note") == 0) {
|
} else if (strcmp(s, "Note") == 0) {
|
||||||
xasprintf(&prompt, "(%s) ", key_string_lookup_key(key));
|
xasprintf(&prompt, "(%s) ", key_string_lookup_key(key, 0));
|
||||||
|
|
||||||
new_item = xcalloc(1, sizeof *new_item);
|
new_item = xcalloc(1, sizeof *new_item);
|
||||||
new_item->data = data;
|
new_item->data = data;
|
||||||
@ -1395,7 +1395,7 @@ window_customize_key(struct window_mode_entry *wme, struct client *c,
|
|||||||
break;
|
break;
|
||||||
if (item->scope == WINDOW_CUSTOMIZE_KEY) {
|
if (item->scope == WINDOW_CUSTOMIZE_KEY) {
|
||||||
xasprintf(&prompt, "Unbind key %s? ",
|
xasprintf(&prompt, "Unbind key %s? ",
|
||||||
key_string_lookup_key(item->key));
|
key_string_lookup_key(item->key, 0));
|
||||||
} else
|
} else
|
||||||
xasprintf(&prompt, "Unset option %s? ", item->name);
|
xasprintf(&prompt, "Unset option %s? ", item->name);
|
||||||
data->references++;
|
data->references++;
|
||||||
|
6
window.c
6
window.c
@ -1145,8 +1145,10 @@ window_pane_key(struct window_pane *wp, struct client *c, struct session *s,
|
|||||||
|
|
||||||
wme = TAILQ_FIRST(&wp->modes);
|
wme = TAILQ_FIRST(&wp->modes);
|
||||||
if (wme != NULL) {
|
if (wme != NULL) {
|
||||||
if (wme->mode->key != NULL && c != NULL)
|
if (wme->mode->key != NULL && c != NULL) {
|
||||||
wme->mode->key(wme, c, s, wl, (key & ~KEYC_XTERM), m);
|
key &= ~KEYC_MASK_FLAGS;
|
||||||
|
wme->mode->key(wme, c, s, wl, key, m);
|
||||||
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user