diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2020-05-15 17:40:24 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2020-05-15 17:40:24 +0100 |
commit | c364a7142c10af9a82b0ef19a3ef204b605a225d (patch) | |
tree | 45e7c1dc54f4e6ea894bede5dfaecaad89bd26fd | |
parent | 3a4f3ee087ab5273e5d49ab33abf9135c3a21636 (diff) | |
download | rtmux-c364a7142c10af9a82b0ef19a3ef204b605a225d.tar.gz rtmux-c364a7142c10af9a82b0ef19a3ef204b605a225d.tar.bz2 rtmux-c364a7142c10af9a82b0ef19a3ef204b605a225d.zip |
Only forward extended keys if the application has requested them, even though
we use the CSI u sequence and xterm uses CSI 27 ~ - this is what mintty does as
well.
-rw-r--r-- | input-keys.c | 2 | ||||
-rw-r--r-- | input.c | 17 | ||||
-rw-r--r-- | tmux.h | 5 |
3 files changed, 22 insertions, 2 deletions
diff --git a/input-keys.c b/input-keys.c index b7c02ccd..07f102b8 100644 --- a/input-keys.c +++ b/input-keys.c @@ -496,6 +496,8 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key) } /* No builtin key sequence; construct an extended key sequence. */ + if (~s->mode & MODE_KEXTENDED) + goto missing; outkey = (key & KEYC_MASK_KEY); if (outkey >= KEYC_BASE) { switch (outkey) { @@ -241,6 +241,8 @@ enum input_csi_type { INPUT_CSI_HPA, INPUT_CSI_ICH, INPUT_CSI_IL, + INPUT_CSI_MODOFF, + INPUT_CSI_MODSET, INPUT_CSI_RCP, INPUT_CSI_REP, INPUT_CSI_RM, @@ -288,7 +290,9 @@ static const struct input_table_entry input_csi_table[] = { { 'h', "?", INPUT_CSI_SM_PRIVATE }, { 'l', "", INPUT_CSI_RM }, { 'l', "?", INPUT_CSI_RM_PRIVATE }, + { 'm', ">", INPUT_CSI_MODSET }, { 'm', "", INPUT_CSI_SGR }, + { 'n', ">", INPUT_CSI_MODOFF }, { 'n', "", INPUT_CSI_DSR }, { 'q', " ", INPUT_CSI_DECSCUSR }, { 'q', ">", INPUT_CSI_XDA }, @@ -1380,6 +1384,19 @@ input_csi_dispatch(struct input_ctx *ictx) if (n != -1 && m != -1) screen_write_cursormove(sctx, m - 1, n - 1, 1); break; + case INPUT_CSI_MODSET: + n = input_get(ictx, 0, 1, 1); + m = input_get(ictx, 1, 1, 1); + if (n == 0 || (n == 4 && m == 0)) + screen_write_mode_clear(sctx, MODE_KEXTENDED); + else if (n == 4 && (m == 1 || m == 2)) + screen_write_mode_set(sctx, MODE_KEXTENDED); + break; + case INPUT_CSI_MODOFF: + n = input_get(ictx, 0, 1, 1); + if (n == 4) + screen_write_mode_clear(sctx, MODE_KEXTENDED); + break; case INPUT_CSI_WINOPS: input_csi_dispatch_winops(ictx); break; @@ -579,8 +579,8 @@ struct msg_write_close { #define MODE_CURSOR 0x1 #define MODE_INSERT 0x2 #define MODE_KCURSOR 0x4 -#define MODE_KKEYPAD 0x8 /* set = application, clear = number */ -#define MODE_WRAP 0x10 /* whether lines wrap */ +#define MODE_KKEYPAD 0x8 +#define MODE_WRAP 0x10 #define MODE_MOUSE_STANDARD 0x20 #define MODE_MOUSE_BUTTON 0x40 #define MODE_BLINKING 0x80 @@ -591,6 +591,7 @@ struct msg_write_close { #define MODE_MOUSE_ALL 0x1000 #define MODE_ORIGIN 0x2000 #define MODE_CRLF 0x4000 +#define MODE_KEXTENDED 0x8000 #define ALL_MODES 0xffffff #define ALL_MOUSE_MODES (MODE_MOUSE_STANDARD|MODE_MOUSE_BUTTON|MODE_MOUSE_ALL) |