aboutsummaryrefslogtreecommitdiff
path: root/status.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-06-26 15:34:12 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-06-26 15:34:12 +0000
commitde2ea2d1786628172b4c5a19ee7c57246c95be3a (patch)
treea41b478e7b4842152f53e76dafe850bfe33fc5b3 /status.c
parent3fcbe1e27bc8656742671733f987904818ca23d2 (diff)
downloadrtmux-de2ea2d1786628172b4c5a19ee7c57246c95be3a.tar.gz
rtmux-de2ea2d1786628172b4c5a19ee7c57246c95be3a.tar.bz2
rtmux-de2ea2d1786628172b4c5a19ee7c57246c95be3a.zip
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.
Diffstat (limited to 'status.c')
-rw-r--r--status.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/status.c b/status.c
index 6b5bd5bf..c8e8f4b6 100644
--- a/status.c
+++ b/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>
@@ -91,7 +91,6 @@ status_redraw(struct client *c)
rlen2 = screen_write_strlen(utf8flag, "%s", right);
if (rlen2 < rlen)
rlen = rlen2;
- right[rlen] = '\0';
/*
* 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);
if (llen != 0) {
screen_write_cursormove(&ctx, 0, yy);
- screen_write_nputs(
- &ctx, llen + 1, &stdgc, utf8flag, "%s ", left);
+ screen_write_nputs(&ctx, llen, &stdgc, utf8flag, "%s", left);
+ screen_write_putc(&ctx, &stdgc, ' ');
if (larrow)
screen_write_putc(&ctx, &stdgc, ' ');
} else {
@@ -225,8 +224,8 @@ draw:
/* Draw the last item. */
if (rlen != 0) {
screen_write_cursormove(&ctx, c->tty.sx - rlen - 1, yy);
- screen_write_nputs(
- &ctx, rlen + 1, &stdgc, utf8flag, " %s", right);
+ screen_write_putc(&ctx, &stdgc, ' ');
+ screen_write_nputs(&ctx, rlen, &stdgc, utf8flag, "%s", right);
}
/* Draw the arrows. */