aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-01-28 22:46:44 +0000
committerTiago Cunha <tcunha@gmx.com>2010-01-28 22:46:44 +0000
commit95dfa950b81bf5a10c4d4a52d6edb1eaa86330a0 (patch)
tree1a627be2331713e8ea4dbc797523363ae788c058
parent735cfaf09af70df60b90f0b3d64b7d4eb6e34612 (diff)
downloadrtmux-95dfa950b81bf5a10c4d4a52d6edb1eaa86330a0.tar.gz
rtmux-95dfa950b81bf5a10c4d4a52d6edb1eaa86330a0.tar.bz2
rtmux-95dfa950b81bf5a10c4d4a52d6edb1eaa86330a0.zip
Sync OpenBSD patchset 622:
Calculate offset correctly, fixes incorrect offset and prevents crash when status-left is empty. From Micah Cowan.
-rw-r--r--status.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/status.c b/status.c
index a31e579f..a6addbeb 100644
--- a/status.c
+++ b/status.c
@@ -1,4 +1,4 @@
-/* $Id: status.c,v 1.142 2010-01-28 22:44:16 tcunha Exp $ */
+/* $Id: status.c,v 1.143 2010-01-28 22:46:44 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -302,18 +302,20 @@ draw:
}
/* Figure out the offset for the window list. */
- wloffset = 1;
+ if (llen != 0)
+ wloffset = llen + 1;
+ else
+ wloffset = 0;
if (wlwidth < wlavailable) {
switch (options_get_number(&s->options, "status-justify")) {
case 1: /* centered */
- wloffset = 1 + (wlavailable - wlwidth) / 2;
+ wloffset += (wlavailable - wlwidth) / 2;
break;
case 2: /* right */
- wloffset = 1 + (wlavailable - wlwidth);
+ wloffset += (wlavailable - wlwidth);
break;
}
}
- wloffset += llen;
if (larrow != 0)
wloffset++;