mirror of
https://github.com/tmux/tmux.git
synced 2024-11-16 09:28:51 +00:00
Status line fixes: don't truncate status-right now the length calculation is
done for UTF-8, limit to the maximum length correctly when printing, and always print a space even if the left string is longer than the width available.
This commit is contained in:
parent
3fcbe1e27b
commit
de2ea2d178
2
client.c
2
client.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: client.c,v 1.3 2009/06/25 22:09:20 nicm Exp $ */
|
/* $Id $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
|
@ -164,7 +164,7 @@ screen_write_vnputs(struct screen_write_ctx *ctx, ssize_t maxlen,
|
|||||||
gc->flags &= ~GRID_FLAG_UTF8;
|
gc->flags &= ~GRID_FLAG_UTF8;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (maxlen > 0 && size > (size_t) maxlen)
|
if (maxlen > 0 && size + 1 > (size_t) maxlen)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
size++;
|
size++;
|
||||||
|
2
server.c
2
server.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: server.c,v 1.4 2009/06/25 22:09:20 nicm Exp $ */
|
/* $Id $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
|
11
status.c
11
status.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: status.c,v 1.88 2009-06-25 16:34:50 nicm Exp $ */
|
/* $Id $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -91,7 +91,6 @@ status_redraw(struct client *c)
|
|||||||
rlen2 = screen_write_strlen(utf8flag, "%s", right);
|
rlen2 = screen_write_strlen(utf8flag, "%s", right);
|
||||||
if (rlen2 < rlen)
|
if (rlen2 < rlen)
|
||||||
rlen = rlen2;
|
rlen = rlen2;
|
||||||
right[rlen] = '\0';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Figure out how much space we have for the window list. If there isn't
|
* Figure out how much space we have for the window list. If there isn't
|
||||||
@ -167,8 +166,8 @@ draw:
|
|||||||
screen_write_start(&ctx, NULL, &c->status);
|
screen_write_start(&ctx, NULL, &c->status);
|
||||||
if (llen != 0) {
|
if (llen != 0) {
|
||||||
screen_write_cursormove(&ctx, 0, yy);
|
screen_write_cursormove(&ctx, 0, yy);
|
||||||
screen_write_nputs(
|
screen_write_nputs(&ctx, llen, &stdgc, utf8flag, "%s", left);
|
||||||
&ctx, llen + 1, &stdgc, utf8flag, "%s ", left);
|
screen_write_putc(&ctx, &stdgc, ' ');
|
||||||
if (larrow)
|
if (larrow)
|
||||||
screen_write_putc(&ctx, &stdgc, ' ');
|
screen_write_putc(&ctx, &stdgc, ' ');
|
||||||
} else {
|
} else {
|
||||||
@ -225,8 +224,8 @@ draw:
|
|||||||
/* Draw the last item. */
|
/* Draw the last item. */
|
||||||
if (rlen != 0) {
|
if (rlen != 0) {
|
||||||
screen_write_cursormove(&ctx, c->tty.sx - rlen - 1, yy);
|
screen_write_cursormove(&ctx, c->tty.sx - rlen - 1, yy);
|
||||||
screen_write_nputs(
|
screen_write_putc(&ctx, &stdgc, ' ');
|
||||||
&ctx, rlen + 1, &stdgc, utf8flag, " %s", right);
|
screen_write_nputs(&ctx, rlen, &stdgc, utf8flag, "%s", right);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw the arrows. */
|
/* Draw the arrows. */
|
||||||
|
Loading…
Reference in New Issue
Block a user