Fix various silly problems with status line off.

This commit is contained in:
Nicholas Marriott 2009-01-19 20:14:55 +00:00
parent 94471aab82
commit 2afa8ebc02
4 changed files with 26 additions and 19 deletions

View File

@ -1,5 +1,6 @@
19 January 2009 19 January 2009
* Fix various stupid issues when the status line is turned off. Grr.
* Use reverse attributes for clock and cursor, otherwise they do not * Use reverse attributes for clock and cursor, otherwise they do not
appear on black and white terminals. appear on black and white terminals.
* An error in a command sequence now stops execution of that sequence. * An error in a command sequence now stops execution of that sequence.
@ -969,7 +970,7 @@
(including mutt, emacs). No status bar yet and no key remapping or other (including mutt, emacs). No status bar yet and no key remapping or other
customisation. customisation.
$Id: CHANGES,v 1.223 2009-01-19 19:01:11 nicm Exp $ $Id: CHANGES,v 1.224 2009-01-19 20:14:55 nicm Exp $
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms

4
TODO
View File

@ -83,3 +83,7 @@
- bring back -l/-p on splitw so i can do "splitw -p 75 elinks" - bring back -l/-p on splitw so i can do "splitw -p 75 elinks"
- UTF-8 combining characters don't work (probably should be width 1 but are - UTF-8 combining characters don't work (probably should be width 1 but are
listed as 2) listed as 2)
- client sx/sy should be in tty, then can let the terminal wrap at edge
to allow xterm to pick up it should be one line for its c/p
- with no status line and when window sy<cy, use blank line
- doesn't redraw last line properly when status is off

View File

@ -1,4 +1,4 @@
/* $Id: screen-redraw.c,v 1.19 2009-01-14 21:00:41 nicm Exp $ */ /* $Id: screen-redraw.c,v 1.20 2009-01-19 20:14:55 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -53,14 +53,14 @@ screen_redraw_screen(struct client *c, struct screen *s)
s = wp->screen; s = wp->screen;
sy = screen_size_y(s); sy = screen_size_y(s);
if (!status && TAILQ_NEXT(wp, entry) == NULL)
sy--;
cx = s->cx; cx = s->cx;
cy = s->cy; cy = s->cy;
if (wp->yoff + sy <= w->sy) { if (wp->yoff + sy <= w->sy) {
for (i = 0; i < sy; i++) for (i = 0; i < sy; i++) {
screen_redraw_line(c, s, wp->yoff, i); if (wp->yoff + i != c->sy - 1)
screen_redraw_line(c, s, wp->yoff, i);
}
if (TAILQ_NEXT(wp, entry) != NULL) if (TAILQ_NEXT(wp, entry) != NULL)
screen_redraw_blanky(c, wp->yoff + sy, 1, '-'); screen_redraw_blanky(c, wp->yoff + sy, 1, '-');
} }
@ -70,7 +70,7 @@ screen_redraw_screen(struct client *c, struct screen *s)
/* Fill in empty space below. */ /* Fill in empty space below. */
if (w->sy < c->sy - status) if (w->sy < c->sy - status)
screen_redraw_blanky(c, w->sy, c->sy - w->sy, '='); screen_redraw_blanky(c, w->sy, c->sy - status - w->sy, '=');
/* Draw the status line. */ /* Draw the status line. */
screen_redraw_status(c); screen_redraw_status(c);

View File

@ -1,4 +1,4 @@
/* $Id: status.c,v 1.65 2009-01-19 19:01:11 nicm Exp $ */ /* $Id: status.c,v 1.66 2009-01-19 20:14:55 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -53,6 +53,13 @@ status_redraw(struct client *c)
left = right = NULL; left = right = NULL;
/* Resize the target screen. */
if (screen_size_x(&c->status) != c->sx) {
screen_free(&c->status);
screen_init(&c->status, c->sx, 1, 0);
}
/* No status line? */
if (c->sy == 0 || !options_get_number(&s->options, "status")) if (c->sy == 0 || !options_get_number(&s->options, "status"))
goto off; goto off;
larrow = rarrow = 0; larrow = rarrow = 0;
@ -67,6 +74,7 @@ status_redraw(struct client *c)
if (yy == 0) if (yy == 0)
goto blank; goto blank;
/* Work out the left and right strings. */
left = status_replace(s, options_get_string( left = status_replace(s, options_get_string(
&s->options, "status-left"), c->status_timer.tv_sec); &s->options, "status-left"), c->status_timer.tv_sec);
llen = options_get_number(&s->options, "status-left-length"); llen = options_get_number(&s->options, "status-left-length");
@ -147,12 +155,6 @@ status_redraw(struct client *c)
width = xx; width = xx;
draw: draw:
/* Resize the target screen. */
if (screen_size_x(&c->status) != c->sx) {
screen_free(&c->status);
screen_init(&c->status, c->sx, 1, 0);
}
/* Bail here if anything is too small too. XXX. */ /* Bail here if anything is too small too. XXX. */
if (width == 0 || xx == 0) if (width == 0 || xx == 0)
goto blank; goto blank;
@ -259,20 +261,20 @@ off:
* Draw the real window last line. Necessary to wipe over message if * Draw the real window last line. Necessary to wipe over message if
* status is off. Not sure this is the right place for this. * status is off. Not sure this is the right place for this.
*/ */
memcpy(&gc, &grid_default_cell, sizeof gc);
screen_write_start(&ctx, NULL, &c->status); screen_write_start(&ctx, NULL, &c->status);
sy = 0; sy = 0;
TAILQ_FOREACH(wp, &s->curw->window->panes, entry) { TAILQ_FOREACH(wp, &s->curw->window->panes, entry) {
sy += wp->sy; sy += wp->sy + 1;
sc = wp->screen; sc = wp->screen;
} }
sy++;
screen_write_cursormove(&ctx, 0, 0); screen_write_cursormove(&ctx, 0, 0);
if (sy < c->sy - 1) { if (sy < c->sy) {
/* If the screen is too small, use blank. */ /* If the screen is too small, use blank. */
for (offset = 0; offset < c->sx; offset++) for (offset = 0; offset < c->sx; offset++)
screen_write_putc(&ctx, &gc, ' '); screen_write_putc(&ctx, &gc, ' ');
} else { } else {
screen_write_copy(&ctx, screen_write_copy(&ctx,
sc, 0, sc->grid->hsize + screen_size_y(sc) - 1, c->sx, 1); sc, 0, sc->grid->hsize + screen_size_y(sc) - 1, c->sx, 1);