aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--screen-write.c2
-rw-r--r--status.c9
2 files changed, 5 insertions, 6 deletions
diff --git a/screen-write.c b/screen-write.c
index f0cdec30..e3a215ac 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -164,7 +164,7 @@ screen_write_vnputs(struct screen_write_ctx *ctx, ssize_t maxlen,
gc->flags &= ~GRID_FLAG_UTF8;
} else {
- if (maxlen > 0 && size > (size_t) maxlen)
+ if (maxlen > 0 && size + 1 > (size_t) maxlen)
break;
size++;
diff --git a/status.c b/status.c
index 98061dd0..8aea62a7 100644
--- a/status.c
+++ b/status.c
@@ -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. */