summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/server.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-08-14 11:23:34 +0000
committernicm <nicm@openbsd.org>2009-08-14 11:23:34 +0000
commit45400b512e9991e69fcc25e29bdb41ff0b2c5482 (patch)
treebdf10954b2c5881c27d2a89659f1c0dd35706694 /usr.bin/tmux/server.c
parentInitialize len variable; found by Martynas Venckus (diff)
downloadwireguard-openbsd-45400b512e9991e69fcc25e29bdb41ff0b2c5482.tar.xz
wireguard-openbsd-45400b512e9991e69fcc25e29bdb41ff0b2c5482.zip
Reset attributes as well as scroll region before poll(2) and add a big comment
explaining why.
Diffstat (limited to 'usr.bin/tmux/server.c')
-rw-r--r--usr.bin/tmux/server.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c
index 1af4027129d..128183b8b22 100644
--- a/usr.bin/tmux/server.c
+++ b/usr.bin/tmux/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.20 2009/08/11 22:34:17 nicm Exp $ */
+/* $OpenBSD: server.c,v 1.21 2009/08/14 11:23:34 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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. */