mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 10:58:48 +00:00
Fix a couple of bugs. Handle 0 width properly (w/o overflow), and draw left < in the right place.
This commit is contained in:
parent
2d3ea8b5b4
commit
f9dedfccca
30
status.c
30
status.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: status.c,v 1.28 2008-06-18 17:14:02 nicm Exp $ */
|
/* $Id: status.c,v 1.29 2008-06-18 17:28:17 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -99,8 +99,10 @@ status_redraw(struct client *c)
|
|||||||
* start and just leave off the end.
|
* start and just leave off the end.
|
||||||
*/
|
*/
|
||||||
if (offset + size < xx) {
|
if (offset + size < xx) {
|
||||||
rarrow = 1;
|
if (xx > 0) {
|
||||||
xx--;
|
rarrow = 1;
|
||||||
|
xx--;
|
||||||
|
}
|
||||||
|
|
||||||
width = xx;
|
width = xx;
|
||||||
goto draw;
|
goto draw;
|
||||||
@ -111,11 +113,13 @@ status_redraw(struct client *c)
|
|||||||
* are xx characters to fill, and offset + size must be the last. So,
|
* are xx characters to fill, and offset + size must be the last. So,
|
||||||
* the start character is offset + size - xx.
|
* the start character is offset + size - xx.
|
||||||
*/
|
*/
|
||||||
larrow = 1;
|
if (xx > 0) {
|
||||||
xx--;
|
larrow = 1;
|
||||||
|
xx--;
|
||||||
|
}
|
||||||
|
|
||||||
start = offset + size - xx;
|
start = offset + size - xx;
|
||||||
if (width > start + xx + 1) { /* + 1, eh? */
|
if (xx > 0 && width > start + xx + 1) { /* + 1, eh? */
|
||||||
rarrow = 1;
|
rarrow = 1;
|
||||||
start++;
|
start++;
|
||||||
xx--;
|
xx--;
|
||||||
@ -123,6 +127,10 @@ status_redraw(struct client *c)
|
|||||||
width = xx;
|
width = xx;
|
||||||
|
|
||||||
draw:
|
draw:
|
||||||
|
/* Bail here if anything is too small too. XXX. */
|
||||||
|
if (width == 0 || xx == 0)
|
||||||
|
goto blank;
|
||||||
|
|
||||||
/* Begin drawing and move to the starting position. */
|
/* Begin drawing and move to the starting position. */
|
||||||
screen_redraw_start_client(&ctx, c);
|
screen_redraw_start_client(&ctx, c);
|
||||||
screen_redraw_set_attributes(&ctx, 0, colr);
|
screen_redraw_set_attributes(&ctx, 0, colr);
|
||||||
@ -192,7 +200,10 @@ draw:
|
|||||||
screen_redraw_set_attributes(&ctx, ATTR_REVERSE, colr);
|
screen_redraw_set_attributes(&ctx, ATTR_REVERSE, colr);
|
||||||
else
|
else
|
||||||
screen_redraw_set_attributes(&ctx, 0, colr);
|
screen_redraw_set_attributes(&ctx, 0, colr);
|
||||||
screen_redraw_move_cursor(&ctx, 0, yy);
|
if (llen != 0)
|
||||||
|
screen_redraw_move_cursor(&ctx, llen + 1, yy);
|
||||||
|
else
|
||||||
|
screen_redraw_move_cursor(&ctx, 0, yy);
|
||||||
ctx.write(ctx.data, TTY_CHARACTER, '<');
|
ctx.write(ctx.data, TTY_CHARACTER, '<');
|
||||||
}
|
}
|
||||||
if (rarrow != 0) {
|
if (rarrow != 0) {
|
||||||
@ -200,7 +211,10 @@ draw:
|
|||||||
screen_redraw_set_attributes(&ctx, ATTR_REVERSE, colr);
|
screen_redraw_set_attributes(&ctx, ATTR_REVERSE, colr);
|
||||||
else
|
else
|
||||||
screen_redraw_set_attributes(&ctx, 0, colr);
|
screen_redraw_set_attributes(&ctx, 0, colr);
|
||||||
screen_redraw_move_cursor(&ctx, c->sx - rlen - 2, yy);
|
if (rlen != 0)
|
||||||
|
screen_redraw_move_cursor(&ctx, c->sx - rlen - 2, yy);
|
||||||
|
else
|
||||||
|
screen_redraw_move_cursor(&ctx, c->sx - 1, yy);
|
||||||
ctx.write(ctx.data, TTY_CHARACTER, '>');
|
ctx.write(ctx.data, TTY_CHARACTER, '>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user