Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2015-11-24 00:01:16 +00:00
commit 3f47ff6ecd
4 changed files with 14 additions and 2 deletions

View File

@ -242,11 +242,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

@ -601,7 +601,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