From 05213e4c8cb083669382e0287481df994827352f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 27 Jan 2010 20:26:42 +0000 Subject: [PATCH] Calculate offset correctly, fixes incorrect offset and prevents crash when status-left is empty. From Micah Cowan. --- status.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/status.c b/status.c index ee8f2390..5576cff9 100644 --- a/status.c +++ b/status.c @@ -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++;