From 7cebf4768b90bd004eadcec4eb7ff67d6868183f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 19 Jun 2008 23:07:11 +0000 Subject: [PATCH] Hide cursor with flag. --- server-fn.c | 6 +++++- tmux.h | 5 ++++- tty.c | 6 ++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/server-fn.c b/server-fn.c index 61524947..de5ae0ed 100644 --- a/server-fn.c +++ b/server-fn.c @@ -1,4 +1,4 @@ -/* $Id: server-fn.c,v 1.45 2008-06-19 20:45:20 nicm Exp $ */ +/* $Id: server-fn.c,v 1.46 2008-06-19 23:07:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -33,6 +33,7 @@ server_set_client_message(struct client *c, const char *msg) fatal("clock_gettime"); timespecadd(&c->message_timer, &ts, &c->message_timer); + c->tty.flags |= TTY_NOCURSOR; c->flags |= CLIENT_STATUS; } @@ -45,6 +46,7 @@ server_clear_client_message(struct client *c) xfree(c->message_string); c->message_string = NULL; + c->tty.flags &= ~TTY_NOCURSOR; c->flags |= CLIENT_STATUS; } @@ -60,6 +62,7 @@ server_set_client_prompt( c->prompt_callback = fn; c->prompt_data = data; + c->tty.flags |= TTY_NOCURSOR; c->flags |= CLIENT_STATUS; } @@ -74,6 +77,7 @@ server_clear_client_prompt(struct client *c) xfree(c->prompt_buffer); + c->tty.flags &= ~TTY_NOCURSOR; c->flags |= CLIENT_STATUS; } diff --git a/tmux.h b/tmux.h index 2d066f03..153e4295 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.154 2008-06-19 20:45:21 nicm Exp $ */ +/* $Id: tmux.h,v 1.155 2008-06-19 23:07:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -651,6 +651,9 @@ struct tty { u_char acs[UCHAR_MAX + 1]; +#define TTY_NOCURSOR 0x1 + int flags; + size_t ksize; /* maximum key size */ RB_HEAD(tty_keys, tty_key) ktree; }; diff --git a/tty.c b/tty.c index 424951f3..503ea365 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.28 2008-06-18 22:21:51 nicm Exp $ */ +/* $Id: tty.c,v 1.29 2008-06-19 23:07:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -79,6 +79,8 @@ tty_open(struct tty *tty, char **cause) tty->attr = 0; tty->colr = 0x70; + tty->flags = 0; + tty_keys_init(tty); tty_fill_acs(tty); @@ -493,7 +495,7 @@ tty_vwrite(struct tty *tty, struct screen *s, int cmd, va_list ap) } break; case TTY_CURSORON: - if (cursor_normal != NULL) + if (!(tty->flags & TTY_NOCURSOR) && cursor_normal != NULL) tty_puts(tty, cursor_normal); break; case TTY_CURSOROFF: