aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-08-16 19:33:49 +0000
committerTiago Cunha <tcunha@gmx.com>2009-08-16 19:33:49 +0000
commita2a8518f74cd26a116006319a3063afe1ec631e3 (patch)
treecf780577df5c6a7c3b126696c65e0f0363b077d2
parent7182f6d799cb3b2fc06be8f4ad2f79f2d0dbd10a (diff)
downloadrtmux-a2a8518f74cd26a116006319a3063afe1ec631e3.tar.gz
rtmux-a2a8518f74cd26a116006319a3063afe1ec631e3.tar.bz2
rtmux-a2a8518f74cd26a116006319a3063afe1ec631e3.zip
Sync OpenBSD patchset 263:
Reset attributes as well as scroll region before poll(2) and add a big comment explaining why.
-rw-r--r--server.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/server.c b/server.c
index 9ab635f9..436d55bb 100644
--- a/server.c
+++ b/server.c
@@ -1,4 +1,4 @@
-/* $Id: server.c,v 1.169 2009-08-14 21:24:46 tcunha Exp $ */
+/* $Id: server.c,v 1.170 2009-08-16 19:33:49 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -884,7 +884,16 @@ server_handle_client(struct client *c)
wp = c->session->curw->window->active; /* could die - do each loop */
s = wp->screen;
- /* Ensure cursor position and mode settings. */
+ /*
+ * Update cursor position and mode settings. The scroll region and
+ * attributes are cleared across poll(2) as this is the most likely
+ * time a user may interrupt tmux, for example with ~^Z in ssh(1). This
+ * is a compromise between excessive resets and likelihood of an
+ * interrupt.
+ *
+ * tty_region/tty_reset/tty_update_mode already take care of not
+ * resetting things that are already in their default state.
+ */
status = options_get_number(&c->session->options, "status");
tty_region(&c->tty, 0, c->tty.sy - 1, 0);
if (!window_pane_visible(wp) || wp->yoff + s->cy >= c->tty.sy - status)
@@ -896,6 +905,7 @@ server_handle_client(struct client *c)
if (server_locked)
mode &= ~TTY_NOCURSOR;
tty_update_mode(&c->tty, mode);
+ tty_reset(&c->tty);
}
/* Lost a client. */