Partly revert previous, it is harmless to keep support for UTF-8 mouse

mode inside tmux, just no longer support it for tmux itself.
This commit is contained in:
nicm 2015-11-23 23:47:57 +00:00
parent 32e510bd70
commit 2adf3f42ee
4 changed files with 14 additions and 2 deletions

View File

@ -243,11 +243,17 @@ input_key_mouse(struct window_pane *wp, struct mouse_event *m)
* is because an old style mouse release event cannot be converted into
* the new SGR format, since the released button is unknown). Otherwise
* pretend that tmux doesn't speak this extension, and fall back to the
* UTF-8 (1005) extension if the application requested, or to the
* legacy format.
*/
if (m->sgr_type != ' ' && (wp->screen->mode & MODE_MOUSE_SGR)) {
len = xsnprintf(buf, sizeof buf, "\033[<%u;%u;%u%c",
m->sgr_b, x + 1, y + 1, m->sgr_type);
} else if (wp->screen->mode & MODE_MOUSE_UTF8) {
len = xsnprintf(buf, sizeof buf, "\033[M");
len += utf8_split2(m->b + 32, &buf[len]);
len += utf8_split2(x + 33, &buf[len]);
len += utf8_split2(y + 33, &buf[len]);
} else {
if (m->b > 223)
return;

View File

@ -1461,6 +1461,9 @@ input_csi_dispatch_rm_private(struct input_ctx *ictx)
case 1004:
screen_write_mode_clear(&ictx->ctx, MODE_FOCUSON);
break;
case 1005:
screen_write_mode_clear(&ictx->ctx, MODE_MOUSE_UTF8);
break;
case 1006:
screen_write_mode_clear(&ictx->ctx, MODE_MOUSE_SGR);
break;
@ -1541,6 +1544,9 @@ input_csi_dispatch_sm_private(struct input_ctx *ictx)
screen_write_mode_set(&ictx->ctx, MODE_FOCUSON);
wp->flags |= PANE_FOCUSPUSH; /* force update */
break;
case 1005:
screen_write_mode_set(&ictx->ctx, MODE_MOUSE_UTF8);
break;
case 1006:
screen_write_mode_set(&ictx->ctx, MODE_MOUSE_SGR);
break;

View File

@ -56,7 +56,7 @@ screen_write_reset(struct screen_write_ctx *ctx)
screen_write_scrollregion(ctx, 0, screen_size_y(s) - 1);
s->mode &= ~(MODE_INSERT|MODE_KCURSOR|MODE_KKEYPAD|MODE_FOCUSON);
s->mode &= ~(ALL_MOUSE_MODES|MODE_MOUSE_SGR);
s->mode &= ~(ALL_MOUSE_MODES|MODE_MOUSE_UTF8|MODE_MOUSE_SGR);
screen_write_clearscreen(ctx);
screen_write_cursormove(ctx, 0, 0);

2
tmux.h
View File

@ -599,7 +599,7 @@ struct mode_key_table {
#define MODE_MOUSE_STANDARD 0x20
#define MODE_MOUSE_BUTTON 0x40
#define MODE_BLINKING 0x80
/* 0x100 unused */
#define MODE_MOUSE_UTF8 0x100
#define MODE_MOUSE_SGR 0x200
#define MODE_BRACKETPASTE 0x400
#define MODE_FOCUSON 0x800