From 08d0e4cd5c0755484a6baaadc83a285f1099d5a5 Mon Sep 17 00:00:00 2001
From: George Nachman <gnachman@gmail.com>
Date: Wed, 29 Apr 2015 21:52:17 -0700
Subject: [PATCH] Hide cursor while drawing borders

---
 screen-redraw.c | 5 +++++
 tty.c           | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/screen-redraw.c b/screen-redraw.c
index e3369b8..f96ee4a 100644
--- a/screen-redraw.c
+++ b/screen-redraw.c
@@ -284,6 +284,10 @@ screen_redraw_draw_borders(struct client *c, int status, u_int top)
 	char			 msg[256];
 	const char		*tmp;
 	size_t			 msglen = 0;
+        int			 saved_mode;
+
+        saved_mode = tty->mode;
+	tty_update_mode(tty, tty->mode & ~MODE_CURSOR, NULL);
 
 	small = (tty->sy - status + top > w->sy) || (tty->sx > w->sx);
 	if (small) {
@@ -337,6 +341,7 @@ screen_redraw_draw_borders(struct client *c, int status, u_int top)
 		tty_cursor(tty, msgx, msgy);
 		tty_puts(tty, msg);
 	}
+	tty_update_mode(tty, saved_mode, NULL);
 }
 
 /* Draw the panes. */
diff --git a/tty.c b/tty.c
index f6db8e2..55d094e 100644
--- a/tty.c
+++ b/tty.c
@@ -500,7 +500,7 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s)
 {
 	int	changed;
 
-	if (strcmp(s->ccolour, tty->ccolour))
+        if (s != NULL && strcmp(s->ccolour, tty->ccolour))
 		tty_force_cursor_colour(tty, s->ccolour);
 
 	if (tty->flags & TTY_NOCURSOR)
@@ -517,7 +517,7 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s)
 		} else
 			tty_putcode(tty, TTYC_CIVIS);
 	}
-	if (tty->cstyle != s->cstyle) {
+	if (s != NULL && tty->cstyle != s->cstyle) {
 		if (tty_term_has(tty->term, TTYC_SS)) {
 			if (s->cstyle == 0 &&
 			    tty_term_has(tty->term, TTYC_SE))
-- 
2.2.2

