diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-07-20 14:32:09 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-07-20 14:32:09 +0000 |
commit | b292f71c49b4222b34684aee44029ca2d6aeb4dd (patch) | |
tree | 819115b78b93b6bd560de429d09caa36ee57199a /status.c | |
parent | e32e0d569294ca7162f197cc7c369cd57050b193 (diff) | |
download | rtmux-b292f71c49b4222b34684aee44029ca2d6aeb4dd.tar.gz rtmux-b292f71c49b4222b34684aee44029ca2d6aeb4dd.tar.bz2 rtmux-b292f71c49b4222b34684aee44029ca2d6aeb4dd.zip |
Add a status-justify option to allow the window list in the status line to be
positioned at the left, centre, or right.
Diffstat (limited to 'status.c')
-rw-r--r-- | status.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -46,7 +46,7 @@ status_redraw(struct client *c) struct screen old_status; char *left, *right, *text, *ptr; size_t llen, llen2, rlen, rlen2, offset; - size_t xx, yy, size, start, width; + size_t ox, xx, yy, size, start, width; struct grid_cell stdgc, gc; int larrow, rarrow, utf8flag; @@ -175,6 +175,21 @@ draw: screen_write_cursormove(&ctx, 0, yy); } + ox = 0; + if (width < xx) { + switch (options_get_number(&s->options, "status-justify")) { + case 1: /* centered */ + ox = 1 + (xx - width) / 2; + break; + case 2: /* right */ + ox = 1 + (xx - width); + break; + } + xx -= ox; + while (ox-- > 0) + screen_write_putc(&ctx, &stdgc, ' '); + } + /* Draw each character in succession. */ offset = 0; RB_FOREACH(wl, winlinks, &s->windows) { |