summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-02-26 13:26:44 +0000
committerTiago Cunha <tcunha@gmx.com>2010-02-26 13:26:44 +0000
commitecac081a555b6513b91c5e0b8c93fa753e41becf (patch)
tree87394a38f2586e7c88e495f6fbbebf1fef308b4b
parentb4c2710bf7e155586592e95f600e98cd8518f098 (diff)
Sync OpenBSD patchset 648:
copy mode uses the real screen as backing and if it is updated while copying, strange things can happen. So, freeze reading from the pty while in copy mode.
-rw-r--r--server-window.c6
-rw-r--r--tmux.h3
-rw-r--r--window-copy.c8
3 files changed, 13 insertions, 4 deletions
diff --git a/server-window.c b/server-window.c
index 88002a3a..2a933cc3 100644
--- a/server-window.c
+++ b/server-window.c
@@ -1,4 +1,4 @@
-/* $Id: server-window.c,v 1.13 2009-12-04 22:14:47 tcunha Exp $ */
+/* $Id: server-window.c,v 1.14 2010-02-26 13:26:44 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -69,7 +69,9 @@ server_window_loop(void)
continue;
TAILQ_FOREACH(wp, &w->panes, entry) {
- if (wp->fd != -1) {
+ if (wp->fd == -1)
+ continue;
+ if (!(wp->flags & PANE_FREEZE)) {
if (server_window_backoff(wp))
bufferevent_disable(wp->event, EV_READ);
else
diff --git a/tmux.h b/tmux.h
index 2c8a4d63..66c95aae 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.545 2010-02-18 12:35:16 tcunha Exp $ */
+/* $Id: tmux.h,v 1.546 2010-02-26 13:26:44 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -786,6 +786,7 @@ struct window_pane {
int flags;
#define PANE_REDRAW 0x1
+#define PANE_FREEZE 0x2
char *cmd;
char *shell;
diff --git a/window-copy.c b/window-copy.c
index 436b7b7a..6579a3f0 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -1,4 +1,4 @@
-/* $Id: window-copy.c,v 1.104 2010-02-18 12:38:24 tcunha Exp $ */
+/* $Id: window-copy.c,v 1.105 2010-02-26 13:26:44 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -138,6 +138,9 @@ window_copy_init(struct window_pane *wp)
data->searchtype = WINDOW_COPY_OFF;
data->searchstr = NULL;
+ wp->flags |= PANE_FREEZE;
+ bufferevent_disable(wp->event, EV_READ|EV_WRITE);
+
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"))
@@ -166,6 +169,9 @@ window_copy_free(struct window_pane *wp)
{
struct window_copy_mode_data *data = wp->modedata;
+ wp->flags &= ~PANE_FREEZE;
+ bufferevent_enable(wp->event, EV_READ|EV_WRITE);
+
if (data->searchstr != NULL)
xfree(data->searchstr);
xfree(data->inputstr);