Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv30568
Modified Files:
input-keys.c input.c screen-write.c server-client.c tmux.h
tty.c window-choose.c window-copy.c
Log Message:
Sync OpenBSD patchset 812:
Support all four of the xterm mouse modes. Based on a diff from hsim at
gmx.li.
Index: tty.c
===================================================================
RCS file: /cvsroot/tmux/tmux/tty.c,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -d -r1.197 -r1.198
--- tty.c 6 Dec 2010 21:57:56 -0000 1.197
+++ tty.c 30 Dec 2010 22:27:38 -0000 1.198
@@ -403,17 +403,25 @@
else
tty_putcode(tty, TTYC_CIVIS);
}
- if (changed & (MODE_MOUSE|MODE_MOUSEMOTION)) {
- if (mode & MODE_MOUSE) {
- if (mode & MODE_MOUSEMOTION)
- tty_puts(tty, "\033[?1003h");
- else
+ if (changed & ALL_MOUSE_MODES) {
+ if (mode & ALL_MOUSE_MODES) {
+ if (mode & MODE_MOUSE_STANDARD)
tty_puts(tty, "\033[?1000h");
+ else if (mode & MODE_MOUSE_HIGHLIGHT)
+ tty_puts(tty, "\033[?1001h");
+ else if (mode & MODE_MOUSE_BUTTON)
+ tty_puts(tty, "\033[?1002h");
+ else if (mode & MODE_MOUSE_ANY)
+ tty_puts(tty, "\033[?1003h");
} else {
- if (mode & MODE_MOUSEMOTION)
- tty_puts(tty, "\033[?1003l");
- else
+ if (tty->mode & MODE_MOUSE_STANDARD)
tty_puts(tty, "\033[?1000l");
+ else if (tty->mode & MODE_MOUSE_HIGHLIGHT)
+ tty_puts(tty, "\033[?1001l");
+ else if (tty->mode & MODE_MOUSE_BUTTON)
+ tty_puts(tty, "\033[?1002l");
+ else if (tty->mode & MODE_MOUSE_ANY)
+ tty_puts(tty, "\033[?1003l");
}
}
if (changed & MODE_KKEYPAD) {
Index: window-choose.c
===================================================================
RCS file: /cvsroot/tmux/tmux/window-choose.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- window-choose.c 22 May 2010 21:56:04 -0000 1.30
+++ window-choose.c 30 Dec 2010 22:27:38 -0000 1.31
@@ -127,7 +127,7 @@
screen_init(s, screen_size_x(&wp->base), screen_size_y(&wp->base), 0);
s->mode &= ~MODE_CURSOR;
if (options_get_number(&wp->window->options, "mode-mouse"))
- s->mode |= MODE_MOUSE;
+ s->mode |= MODE_MOUSE_STANDARD;
keys = options_get_number(&wp->window->options, "mode-keys");
if (keys == MODEKEY_EMACS)
Index: server-client.c
===================================================================
RCS file: /cvsroot/tmux/tmux/server-client.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- server-client.c 22 Dec 2010 15:31:00 -0000 1.48
+++ server-client.c 30 Dec 2010 22:27:38 -0000 1.49
@@ -449,7 +449,7 @@
mode = s->mode;
if (TAILQ_NEXT(TAILQ_FIRST(&w->panes), entry) != NULL &&
options_get_number(oo, "mouse-select-pane"))
- mode |= MODE_MOUSE;
+ mode |= MODE_MOUSE_STANDARD;
tty_update_mode(&c->tty, mode);
tty_reset(&c->tty);
}
Index: input.c
===================================================================
RCS file: /cvsroot/tmux/tmux/input.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- input.c 25 Dec 2010 23:43:53 -0000 1.111
+++ input.c 30 Dec 2010 22:27:38 -0000 1.112
@@ -953,7 +953,7 @@
screen_write_insertmode(sctx, 0);
screen_write_kcursormode(sctx, 0);
screen_write_kkeypadmode(sctx, 0);
- screen_write_mousemode(sctx, 0);
+ screen_write_mousemode_off(sctx);
screen_write_clearscreen(sctx);
screen_write_cursormove(sctx, 0, 0);
@@ -1156,7 +1156,10 @@
screen_write_cursormode(&ictx->ctx, 0);
break;
case 1000:
- screen_write_mousemode(&ictx->ctx, 0);
+ case 1001:
+ case 1002:
+ case 1003:
+ screen_write_mousemode_off(&ictx->ctx);
break;
case 1049:
window_pane_alternate_off(wp, &ictx->cell);
@@ -1192,7 +1195,19 @@
screen_write_cursormode(&ictx->ctx, 1);
break;
case 1000:
- screen_write_mousemode(&ictx->ctx, 1);
+ screen_write_mousemode_on(
+ &ictx->ctx, MODE_MOUSE_STANDARD);
+ break;
+ case 1001:
+ screen_write_mousemode_on(
+ &ictx->ctx, MODE_MOUSE_HIGHLIGHT);
+ break;
+ case 1002:
+ screen_write_mousemode_on(
+ &ictx->ctx, MODE_MOUSE_BUTTON);
+ break;
+ case 1003:
+ screen_write_mousemode_on(&ictx->ctx, MODE_MOUSE_ANY);
break;
case 1049:
window_pane_alternate_on(wp, &ictx->cell);
Index: screen-write.c
===================================================================
RCS file: /cvsroot/tmux/tmux/screen-write.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- screen-write.c 16 Jun 2010 18:09:23 -0000 1.90
+++ screen-write.c 30 Dec 2010 22:27:38 -0000 1.91
@@ -829,16 +829,23 @@
s->mode &= ~MODE_INSERT;
}
-/* Set mouse mode. */
+/* Set mouse mode off. */
void
-screen_write_mousemode(struct screen_write_ctx *ctx, int state)
+screen_write_mousemode_off(struct screen_write_ctx *ctx)
{
struct screen *s = ctx->s;
- if (state)
- s->mode |= MODE_MOUSE;
- else
- s->mode &= ~MODE_MOUSE;
+ s->mode &= ~ALL_MOUSE_MODES;
+}
+
+/* Set mouse mode on. */
+void
+screen_write_mousemode_on(struct screen_write_ctx *ctx, int mode)
+{
+ struct screen *s = ctx->s;
+
+ s->mode &= ~ALL_MOUSE_MODES;
+ s->mode |= mode;
}
/* Line feed. */
Index: window-copy.c
===================================================================
RCS file: /cvsroot/tmux/tmux/window-copy.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -d -r1.125 -r1.126
--- window-copy.c 11 Dec 2010 17:57:28 -0000 1.125
+++ window-copy.c 30 Dec 2010 22:27:38 -0000 1.126
@@ -180,7 +180,7 @@
s = &data->screen;
screen_init(s, screen_size_x(&wp->base), screen_size_y(&wp->base), 0);
if (options_get_number(&wp->window->options, "mode-mouse"))
- s->mode |= MODE_MOUSE;
+ s->mode |= MODE_MOUSE_STANDARD;
keys = options_get_number(&wp->window->options, "mode-keys");
if (keys == MODEKEY_EMACS)
@@ -787,13 +787,14 @@
* If already reading motion, move the cursor while buttons are still
* pressed, or stop the selection on their release.
*/
- if (s->mode & MODE_MOUSEMOTION) {
+ if (s->mode & MODE_MOUSE_ANY) {
if ((m->b & MOUSE_BUTTON) != MOUSE_UP) {
window_copy_update_cursor(wp, m->x, m->y);
if (window_copy_update_selection(wp))
window_copy_redraw_screen(wp);
} else {
- s->mode &= ~MODE_MOUSEMOTION;
+ s->mode &= ~MODE_MOUSE_ANY;
+ s->mode |= MODE_MOUSE_STANDARD;
if (sess != NULL) {
window_copy_copy_selection(wp, sess);
window_pane_reset_mode(wp);
@@ -802,9 +803,10 @@
return;
}
- /* Otherwise i other buttons pressed, start selection and motion. */
+ /* Otherwise if other buttons pressed, start selection and motion. */
if ((m->b & MOUSE_BUTTON) != MOUSE_UP) {
- s->mode |= MODE_MOUSEMOTION;
+ s->mode &= ~MODE_MOUSE_STANDARD;
+ s->mode |= MODE_MOUSE_ANY;
window_copy_update_cursor(wp, m->x, m->y);
window_copy_start_selection(wp);
Index: input-keys.c
===================================================================
RCS file: /cvsroot/tmux/tmux/input-keys.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- input-keys.c 7 Sep 2010 19:32:58 -0000 1.45
+++ input-keys.c 30 Dec 2010 22:27:38 -0000 1.46
@@ -203,7 +203,7 @@
{
char out[8];
- if (wp->screen->mode & MODE_MOUSE) {
+ if (wp->screen->mode & ALL_MOUSE_MODES) {
xsnprintf(out, sizeof out,
"\033[M%c%c%c", m->b + 32, m->x + 33, m->y + 33);
bufferevent_write(wp->event, out, strlen(out));
Index: tmux.h
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.h,v
retrieving revision 1.592
retrieving revision 1.593
diff -u -d -r1.592 -r1.593
--- tmux.h 30 Dec 2010 20:41:08 -0000 1.592
+++ tmux.h 30 Dec 2010 22:27:38 -0000 1.593
@@ -543,9 +543,14 @@
#define MODE_INSERT 0x2
#define MODE_KCURSOR 0x4
#define MODE_KKEYPAD 0x8 /* set = application, clear = number */
-#define MODE_MOUSE 0x10
-#define MODE_MOUSEMOTION 0x20
-#define MODE_WRAP 0x40 /* whether lines wrap */
+#define MODE_WRAP 0x10 /* whether lines wrap */
+#define MODE_MOUSE_STANDARD 0x20
+#define MODE_MOUSE_HIGHLIGHT 0x40
+#define MODE_MOUSE_BUTTON 0x80
+#define MODE_MOUSE_ANY 0x100
+
+#define ALL_MOUSE_MODES (MODE_MOUSE_STANDARD| \
+ MODE_MOUSE_HIGHLIGHT|MODE_MOUSE_BUTTON|MODE_MOUSE_ANY)
/*
* A single UTF-8 character.
@@ -1806,7 +1811,8 @@
void screen_write_reverseindex(struct screen_write_ctx *);
void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int);
void screen_write_insertmode(struct screen_write_ctx *, int);
-void screen_write_mousemode(struct screen_write_ctx *, int);
+void screen_write_mousemode_on(struct screen_write_ctx *, int);
+void screen_write_mousemode_off(struct screen_write_ctx *);
void screen_write_linefeed(struct screen_write_ctx *, int);
void screen_write_linefeedscreen(struct screen_write_ctx *, int);
void screen_write_carriagereturn(struct screen_write_ctx *);
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs