Sort out cursors with a new flag - BACKGROUND - for window modes. Free text on more exit.

This commit is contained in:
Nicholas Marriott 2007-11-21 19:53:57 +00:00
parent acb3661b66
commit d0984b890b
7 changed files with 25 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $Id: screen.c,v 1.32 2007-11-21 18:24:49 nicm Exp $ */
/* $Id: screen.c,v 1.33 2007-11-21 19:53:56 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -250,7 +250,7 @@ screen_draw_stop(struct screen_draw_ctx *ctx)
if (ctx->attr != s->attr || ctx->colr != s->colr)
input_store_two(b, CODE_ATTRIBUTES, s->attr, s->colr);
if (s->mode & MODE_CURSOR)
if (!(s->mode & MODE_BACKGROUND) && s->mode & MODE_CURSOR)
input_store_zero(b, CODE_CURSORON);
}

View File

@ -1,4 +1,4 @@
/* $Id: server-fn.c,v 1.27 2007-11-21 13:11:41 nicm Exp $ */
/* $Id: server-fn.c,v 1.28 2007-11-21 19:53:56 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -180,7 +180,7 @@ server_clear_client(struct client *c)
input_store_zero(c->out, CODE_CLEARLINE);
}
input_store_two(c->out, CODE_CURSORMOVE, s->cy + 1, s->cx + 1);
if (s->mode & MODE_CURSOR)
if (!(s->mode & MODE_BACKGROUND) && s->mode & MODE_CURSOR)
input_store_zero(c->out, CODE_CURSORON);
size = BUFFER_USED(c->out) - size;

View File

@ -1,4 +1,4 @@
/* $Id: status.c,v 1.10 2007-11-21 13:11:41 nicm Exp $ */
/* $Id: status.c,v 1.11 2007-11-21 19:53:56 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -57,7 +57,7 @@ status_write(struct client *c)
input_store_two(b, CODE_ATTRIBUTES, s->attr, s->colr);
input_store_two(b, CODE_CURSORMOVE, s->cy + 1, s->cx + 1);
if (!(s->mode & MODE_HIDDEN) && s->mode & MODE_CURSOR)
if (!(s->mode & MODE_BACKGROUND) && s->mode & MODE_CURSOR)
input_store_zero(b, CODE_CURSORON);
}

5
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.89 2007-11-21 19:44:05 nicm Exp $ */
/* $Id: tmux.h,v 1.90 2007-11-21 19:53:56 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -340,6 +340,7 @@ struct msg_resize_data {
#define MODE_KKEYPAD 0x08
#define MODE_SAVED 0x10
#define MODE_HIDDEN 0x20
#define MODE_BACKGROUND 0x40
/*
* Virtual screen. This is stored as three blocks of 8-bit values, one for
@ -407,7 +408,7 @@ struct screen_draw_ctx {
#define screen_in_y(s, y) ((y) < screen_size_y(s))
#define screen_in_region(s, y) ((y) >= (s)->rupper && (y) <= (s)->rlower)
#define screen_hidden(s) ((s)->mode & MODE_HIDDEN)
#define screen_hidden(s) ((s)->mode & (MODE_HIDDEN|MODE_BACKGROUND))
/* Screen default contents. */
#define SCREEN_DEFDATA ' '

View File

@ -1,4 +1,4 @@
/* $Id: window-more.c,v 1.1 2007-11-21 19:44:05 nicm Exp $ */
/* $Id: window-more.c,v 1.2 2007-11-21 19:53:56 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -73,6 +73,8 @@ window_more_init(struct window *w)
w->modedata = data = xmalloc(sizeof *data);
ARRAY_INIT(&data->list);
data->top = 0;
w->screen.mode |= MODE_BACKGROUND;
}
void
@ -167,7 +169,7 @@ void
window_more_key(struct window *w, int key)
{
struct window_more_mode_data *data = w->modedata;
u_int top, sy;
u_int top, sy, i;
sy = screen_size_y(&w->screen);
@ -176,9 +178,15 @@ window_more_key(struct window *w, int key)
switch (key) {
case 'Q':
case 'q':
for (i = 0; i < ARRAY_LENGTH(&data->list); i++)
xfree(ARRAY_ITEM(&data->list, i));
ARRAY_FREE(&data->list);
w->mode = NULL;
xfree(w->modedata);
w->screen.mode &= ~MODE_BACKGROUND;
recalculate_sizes();
server_redraw_window_all(w);
return;
@ -243,7 +251,6 @@ window_more_up_1(struct window *w)
window_more_draw_position(w, &ctx);
window_more_draw_line(w, &ctx, 1);
screen_draw_stop(&ctx);
input_store_zero(c->out, CODE_CURSOROFF);
size = BUFFER_USED(c->out) - size;
hdr.type = MSG_DATA;
@ -284,7 +291,6 @@ window_more_down_1(struct window *w)
window_more_draw_line(w, &ctx, screen_last_y(s));
window_more_draw_position(w, &ctx);
screen_draw_stop(&ctx);
input_store_zero(c->out, CODE_CURSOROFF);
size = BUFFER_USED(c->out) - size;
hdr.type = MSG_DATA;

View File

@ -1,4 +1,4 @@
/* $Id: window-scroll.c,v 1.8 2007-11-21 19:44:05 nicm Exp $ */
/* $Id: window-scroll.c,v 1.9 2007-11-21 19:53:57 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -55,6 +55,8 @@ window_scroll_init(struct window *w)
w->modedata = data = xmalloc(sizeof *data);
data->ox = data->oy = 0;
data->size = w->screen.hsize;
w->screen.mode |= MODE_BACKGROUND;
}
void
@ -128,6 +130,8 @@ window_scroll_key(struct window *w, int key)
w->mode = NULL;
xfree(w->modedata);
w->screen.mode &= ~MODE_BACKGROUND;
recalculate_sizes();
server_redraw_window_all(w);
return;
@ -200,7 +204,6 @@ window_scroll_up_1(struct window *w)
window_scroll_draw_position(w, &ctx);
screen_draw_line(&ctx, 1); /* nuke old position display */
screen_draw_stop(&ctx);
input_store_zero(c->out, CODE_CURSOROFF);
size = BUFFER_USED(c->out) - size;
hdr.type = MSG_DATA;
@ -241,7 +244,6 @@ window_scroll_down_1(struct window *w)
screen_draw_line(&ctx, screen_last_y(s));
window_scroll_draw_position(w, &ctx);
screen_draw_stop(&ctx);
input_store_zero(c->out, CODE_CURSOROFF);
size = BUFFER_USED(c->out) - size;
hdr.type = MSG_DATA;

View File

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.30 2007-11-21 18:24:49 nicm Exp $ */
/* $Id: window.c,v 1.31 2007-11-21 19:53:57 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -276,8 +276,6 @@ window_resize(struct window *w, u_int sx, u_int sy)
void
window_parse(struct window *w, struct buffer *b)
{
if (w->mode != NULL)
w->screen.mode |= MODE_HIDDEN;
input_parse(w, b);
}