mirror of
https://github.com/tmux/tmux.git
synced 2024-11-18 18:38:54 +00:00
Use screen_draw_* to write message, avoids leaving attribute changes around.
This commit is contained in:
parent
01dd8a3320
commit
b2d78b67d8
2
screen.c
2
screen.c
@ -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>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
|
14
server-fn.c
14
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>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -331,6 +331,7 @@ void printflike2
|
|||||||
server_write_message(struct client *c, const char *fmt, ...)
|
server_write_message(struct client *c, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
struct window *w = c->session->curw->window;
|
struct window *w = c->session->curw->window;
|
||||||
|
struct screen_draw_ctx ctx;
|
||||||
struct hdr hdr;
|
struct hdr hdr;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char *msg;
|
char *msg;
|
||||||
@ -341,9 +342,9 @@ server_write_message(struct client *c, const char *fmt, ...)
|
|||||||
buffer_add(c->out, sizeof hdr);
|
buffer_add(c->out, sizeof hdr);
|
||||||
size = BUFFER_USED(c->out);
|
size = BUFFER_USED(c->out);
|
||||||
|
|
||||||
input_store_zero(c->out, CODE_CURSOROFF);
|
screen_draw_start(&ctx, &w->screen, c->out, 0, 0);
|
||||||
input_store_two(c->out, CODE_CURSORMOVE, c->sy, 1);
|
screen_draw_move(&ctx, 0, c->sy);
|
||||||
input_store_two(c->out, CODE_ATTRIBUTES, ATTR_REVERSE, 0x88);
|
screen_draw_set_attributes(&ctx, ATTR_REVERSE, 0x88);
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
xvasprintf(&msg, fmt, ap);
|
xvasprintf(&msg, fmt, ap);
|
||||||
va_end(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++)
|
for (i = strlen(msg); i < c->sx; i++)
|
||||||
input_store8(c->out, ' ');
|
input_store8(c->out, ' ');
|
||||||
xfree(msg);
|
xfree(msg);
|
||||||
|
screen_draw_stop(&ctx);
|
||||||
|
|
||||||
size = BUFFER_USED(c->out) - size;
|
size = BUFFER_USED(c->out) - size;
|
||||||
hdr.type = MSG_DATA;
|
hdr.type = MSG_DATA;
|
||||||
@ -367,9 +369,9 @@ server_write_message(struct client *c, const char *fmt, ...)
|
|||||||
buffer_add(c->out, sizeof hdr);
|
buffer_add(c->out, sizeof hdr);
|
||||||
size = BUFFER_USED(c->out);
|
size = BUFFER_USED(c->out);
|
||||||
|
|
||||||
if (status_lines == 0) {
|
if (status_lines == 0)
|
||||||
window_draw(w, c->out, screen_last_y(&w->screen), 1);
|
window_draw(w, c->out, screen_last_y(&w->screen), 1);
|
||||||
} else
|
else
|
||||||
status_write(c);
|
status_write(c);
|
||||||
|
|
||||||
size = BUFFER_USED(c->out) - size;
|
size = BUFFER_USED(c->out) - size;
|
||||||
|
Loading…
Reference in New Issue
Block a user