summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2017-06-28 11:36:39 +0000
committernicm <nicm>2017-06-28 11:36:39 +0000
commita00b0d13ede4a0f3743606c79a38eada403f77f9 (patch)
tree374ff3593c70c8e4c062a2619101430423346de6
parent1e376be13d3ed6bd850b15d0292d73d47ad07e94 (diff)
Apply the xterm key flag when needed for send-keys, fixes problem
reported by Franky Spamschleuder.
-rw-r--r--cmd-send-keys.c2
-rw-r--r--input-keys.c2
-rw-r--r--tmux.h4
-rw-r--r--window.c2
4 files changed, 6 insertions, 4 deletions
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index 5c6db347..8d2c2608 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -64,6 +64,8 @@ cmd_send_keys_inject(struct client *c, struct cmdq_item *item, key_code key)
struct key_binding *bd, bd_find;
if (wp->mode == NULL || wp->mode->key_table == NULL) {
+ if (options_get_number(wp->window->options, "xterm-keys"))
+ key |= KEYC_XTERM;
window_pane_key(wp, NULL, s, key, NULL);
return;
}
diff --git a/input-keys.c b/input-keys.c
index c0314db4..34710dac 100644
--- a/input-keys.c
+++ b/input-keys.c
@@ -177,7 +177,7 @@ input_key(struct window_pane *wp, key_code key, struct mouse_event *m)
* 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.
*/
- justkey = (key & ~KEYC_ESCAPE);
+ justkey = (key & ~(KEYC_XTERM|KEYC_ESCAPE));
if (justkey <= 0x7f) {
if (key & KEYC_ESCAPE)
bufferevent_write(wp->event, "\033", 1);
diff --git a/tmux.h b/tmux.h
index ef68c66b..2fdccd2a 100644
--- a/tmux.h
+++ b/tmux.h
@@ -94,8 +94,8 @@ struct tmuxproc;
/* Key modifier bits. */
#define KEYC_ESCAPE 0x200000000000ULL
-#define KEYC_CTRL 0x400000000000ULL
-#define KEYC_SHIFT 0x800000000000ULL
+#define KEYC_CTRL 0x400000000000ULL
+#define KEYC_SHIFT 0x800000000000ULL
#define KEYC_XTERM 0x1000000000000ULL
/* Mask to obtain key w/o modifiers. */
diff --git a/window.c b/window.c
index 4b59f205..ce5166c8 100644
--- a/window.c
+++ b/window.c
@@ -1226,7 +1226,7 @@ window_pane_key(struct window_pane *wp, struct client *c, struct session *s,
if (wp->mode != NULL) {
wp->modelast = time(NULL);
if (wp->mode->key != NULL)
- wp->mode->key(wp, c, s, key, m);
+ wp->mode->key(wp, c, s, (key & ~KEYC_XTERM), m);
return;
}