aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-08-14 11:23:34 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-08-14 11:23:34 +0000
commite7cd547457e40dce8c05c37c358c414d36bac54d (patch)
treedb5d8e572af2c2f6594ccebac384d7751c24290d
parent5cf994856ffcbd95b1821e687dc271c6f81b6e35 (diff)
downloadrtmux-e7cd547457e40dce8c05c37c358c414d36bac54d.tar.gz
rtmux-e7cd547457e40dce8c05c37c358c414d36bac54d.tar.bz2
rtmux-e7cd547457e40dce8c05c37c358c414d36bac54d.zip
Reset attributes as well as scroll region before poll(2) and add a big comment
explaining why.
-rw-r--r--server.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/server.c b/server.c
index eb8843f5..059e1b9d 100644
--- a/server.c
+++ b/server.c
@@ -879,7 +879,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)
@@ -891,6 +900,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. */