Use screen_draw_* to write message, avoids leaving attribute changes around.

This commit is contained in:
Nicholas Marriott 2007-11-24 17:58:45 +00:00
parent 01dd8a3320
commit b2d78b67d8
2 changed files with 16 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $Id: screen.c,v 1.42 2007-11-23 13:02:45 nicm Exp $ */
/* $Id: screen.c,v 1.43 2007-11-24 17:58:45 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>

View File

@ -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>
@ -331,6 +331,7 @@ void printflike2
server_write_message(struct client *c, const char *fmt, ...)
{
struct window *w = c->session->curw->window;
struct screen_draw_ctx ctx;
struct hdr hdr;
va_list ap;
char *msg;
@ -341,9 +342,9 @@ server_write_message(struct client *c, const char *fmt, ...)
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;