summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2010-01-27 20:26:42 +0000
committernicm <nicm@openbsd.org>2010-01-27 20:26:42 +0000
commit4128069997e3419e834fda2fe106ec9d41d6e011 (patch)
tree9a12008c011647a983d049279e1a9fa67d89db6b
parentAlter next-word to have vi-like movement behaviour, and add next-word-end with (diff)
downloadwireguard-openbsd-4128069997e3419e834fda2fe106ec9d41d6e011.tar.xz
wireguard-openbsd-4128069997e3419e834fda2fe106ec9d41d6e011.zip
Calculate offset correctly, fixes incorrect offset and prevents crash when
status-left is empty. From Micah Cowan.
-rw-r--r--usr.bin/tmux/status.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index c6344476c09..d4a28fa9568 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.57 2010/01/26 21:36:53 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.58 2010/01/27 20:26:42 nicm 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++;