diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-07-20 16:01:07 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-07-20 16:01:07 +0000 |
commit | 9a07e8f3724646762708eab10e102a6a9a8c5583 (patch) | |
tree | b28520f17af9760ed4c17472218d5034d23821b9 /status.c | |
parent | e8957009c7766fae83e892c3606b4d163db35b7e (diff) | |
download | rtmux-9a07e8f3724646762708eab10e102a6a9a8c5583.tar.gz rtmux-9a07e8f3724646762708eab10e102a6a9a8c5583.tar.bz2 rtmux-9a07e8f3724646762708eab10e102a6a9a8c5583.zip |
Sync OpenBSD patchset 147:
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 | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.99 2009-07-20 15:57:05 tcunha Exp $ */ +/* $Id: status.c,v 1.100 2009-07-20 16:01:07 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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) { |