summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-11-23 23:47:58 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-11-23 23:47:58 +0000
commite6f9a7266c55059eef58d298703c2bd709014116 (patch)
tree62188b37c124180c57d8eefa75c8a9381da7febd /usr.bin
parent5cb7d6a7b7498bb4210e449f6a6863524e21b294 (diff)
Partly revert previous, it is harmless to keep support for UTF-8 mouse
mode inside tmux, just no longer support it for tmux itself.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/input-keys.c8
-rw-r--r--usr.bin/tmux/input.c8
-rw-r--r--usr.bin/tmux/screen-write.c4
-rw-r--r--usr.bin/tmux/tmux.h4
4 files changed, 18 insertions, 6 deletions
diff --git a/usr.bin/tmux/input-keys.c b/usr.bin/tmux/input-keys.c
index 9c043a910c1..34664253c6c 100644
--- a/usr.bin/tmux/input-keys.c
+++ b/usr.bin/tmux/input-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input-keys.c,v 1.50 2015/11/23 20:53:09 nicm Exp $ */
+/* $OpenBSD: input-keys.c,v 1.51 2015/11/23 23:47:57 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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;
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index 2ef69973ca2..e5521c885d8 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.95 2015/11/23 20:53:09 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.96 2015/11/23 23:47:57 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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;
diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c
index f21d54b2efb..128f4535040 100644
--- a/usr.bin/tmux/screen-write.c
+++ b/usr.bin/tmux/screen-write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen-write.c,v 1.81 2015/11/23 20:53:09 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.82 2015/11/23 23:47:57 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index e24461940bd..5747a528c78 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.585 2015/11/23 20:53:09 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.586 2015/11/23 23:47:57 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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