summaryrefslogtreecommitdiffstats
path: root/server-fn.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-11-24 17:58:45 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-11-24 17:58:45 +0000
commitb2d78b67d8db88a91457a510af00d963535df612 (patch)
tree9cb885786c4748112d5be6f924c6b8e831407598 /server-fn.c
parent01dd8a3320b33c9ef6b802447492a9b699f3295c (diff)
Use screen_draw_* to write message, avoids leaving attribute changes around.
Diffstat (limited to 'server-fn.c')
-rw-r--r--server-fn.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/server-fn.c b/server-fn.c
index f9866da0..2cec2272 100644
--- a/server-fn.c
+++ b/server-fn.c
@@ -1,4 +1,4 @@
-/* $Id: server-fn.c,v 1.31 2007-11-22 18:09:43 nicm Exp $ */
+/* $Id: server-fn.c,v 1.32 2007-11-24 17:58:45 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -330,20 +330,21 @@ server_status_window_all(struct window *w)
void printflike2
server_write_message(struct client *c, const char *fmt, ...)
{
- struct window *w = c->session->curw->window;
- struct hdr hdr;
- va_list ap;
- char *msg;
- size_t size;
- u_int i;
+ struct window *w = c->session->curw->window;
+ struct screen_draw_ctx ctx;
+ struct hdr hdr;
+ va_list ap;
+ char *msg;
+ size_t size;
+ u_int i;
buffer_ensure(c->out, sizeof hdr);
buffer_add(c->out, sizeof hdr);
size = BUFFER_USED(c->out);
- input_store_zero(c->out, CODE_CURSOROFF);
- input_store_two(c->out, CODE_CURSORMOVE, c->sy, 1);
- input_store_two(c->out, CODE_ATTRIBUTES, ATTR_REVERSE, 0x88);
+ screen_draw_start(&ctx, &w->screen, c->out, 0, 0);
+ screen_draw_move(&ctx, 0, c->sy);
+ screen_draw_set_attributes(&ctx, ATTR_REVERSE, 0x88);
va_start(ap, fmt);
xvasprintf(&msg, fmt, ap);
va_end(ap);
@@ -353,6 +354,7 @@ server_write_message(struct client *c, const char *fmt, ...)
for (i = strlen(msg); i < c->sx; i++)
input_store8(c->out, ' ');
xfree(msg);
+ screen_draw_stop(&ctx);
size = BUFFER_USED(c->out) - size;
hdr.type = MSG_DATA;
@@ -367,9 +369,9 @@ server_write_message(struct client *c, const char *fmt, ...)
buffer_add(c->out, sizeof hdr);
size = BUFFER_USED(c->out);
- if (status_lines == 0) {
+ if (status_lines == 0)
window_draw(w, c->out, screen_last_y(&w->screen), 1);
- } else
+ else
status_write(c);
size = BUFFER_USED(c->out) - size;