From 1930181b185134c192d8939a72f86980dca2cb2d Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Fri, 21 Jan 2011 23:56:53 +0000 Subject: [PATCH] Sync OpenBSD patchset 846: Only set a mouse mode for mouse-select-pane if none already set by the mode (any will do). --- server-client.c | 9 +++++++-- tty.c | 18 +++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/server-client.c b/server-client.c index a69d3b23..93ba0fe9 100644 --- a/server-client.c +++ b/server-client.c @@ -1,4 +1,4 @@ -/* $Id: server-client.c,v 1.52 2011-01-21 23:44:13 tcunha Exp $ */ +/* $Id: server-client.c,v 1.53 2011-01-21 23:56:53 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -448,9 +448,14 @@ server_client_reset_state(struct client *c) else tty_cursor(&c->tty, wp->xoff + s->cx, wp->yoff + s->cy); + /* + * Any mode will do for mouse-select-pane, but set standard mode if + * none. + */ mode = s->mode; if (TAILQ_NEXT(TAILQ_FIRST(&w->panes), entry) != NULL && - options_get_number(oo, "mouse-select-pane")) + options_get_number(oo, "mouse-select-pane") && + (mode & ALL_MOUSE_MODES) == 0) mode |= MODE_MOUSE_STANDARD; /* diff --git a/tty.c b/tty.c index c93e0f7d..a4ca686f 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.201 2011-01-21 23:56:11 tcunha Exp $ */ +/* $Id: tty.c,v 1.202 2011-01-21 23:56:53 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -401,19 +401,19 @@ tty_update_mode(struct tty *tty, int mode) if (mode & ALL_MOUSE_MODES) { if (mode & MODE_MOUSE_UTF8) tty_puts(tty, "\033[?1005h"); - if (mode & MODE_MOUSE_STANDARD) - tty_puts(tty, "\033[?1000h"); + if (mode & MODE_MOUSE_ANY) + tty_puts(tty, "\033[?1003h"); 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_MOUSE_STANDARD) + tty_puts(tty, "\033[?1000h"); } else { - if (tty->mode & MODE_MOUSE_STANDARD) - tty_puts(tty, "\033[?1000l"); + if (tty->mode & MODE_MOUSE_ANY) + tty_puts(tty, "\033[?1003l"); else if (tty->mode & MODE_MOUSE_BUTTON) tty_puts(tty, "\033[?1002l"); - else if (tty->mode & MODE_MOUSE_ANY) - tty_puts(tty, "\033[?1003l"); + else if (tty->mode & MODE_MOUSE_STANDARD) + tty_puts(tty, "\033[?1000l"); if (tty->mode & MODE_MOUSE_UTF8) tty_puts(tty, "\033[?1005l"); }