summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-02-19 00:03:22 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-02-19 00:03:22 +0000
commitdb183d40c400294c8eb3e88acd9443335c294463 (patch)
treea27426ba45e2872edbbb70dd12bf1e7540b3a50c /usr.bin/tmux
parentfbbbb4bd7f697ebc9b3f3b682bd69c04eaa6ec58 (diff)
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.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/server-window.c6
-rw-r--r--usr.bin/tmux/tmux.h3
-rw-r--r--usr.bin/tmux/window-copy.c8
3 files changed, 13 insertions, 4 deletions
diff --git a/usr.bin/tmux/server-window.c b/usr.bin/tmux/server-window.c
index 08e83b27abc..a953665b55e 100644
--- a/usr.bin/tmux/server-window.c
+++ b/usr.bin/tmux/server-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-window.c,v 1.13 2009/12/03 22:50:10 nicm Exp $ */
+/* $OpenBSD: server-window.c,v 1.14 2010/02/19 00:03:21 nicm 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/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 446cd5bd10e..9c650c47899 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.207 2010/02/11 20:39:40 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.208 2010/02/19 00:03:21 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -787,6 +787,7 @@ struct window_pane {
int flags;
#define PANE_REDRAW 0x1
+#define PANE_FREEZE 0x2
char *cmd;
char *shell;
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 4bb4dc00b6e..c9541ba6193 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.45 2010/02/17 21:27:18 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.46 2010/02/19 00:03:21 nicm 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);