aboutsummaryrefslogtreecommitdiff
path: root/dmenu.c
diff options
context:
space:
mode:
authorConnor Lane Smith2010-08-10 14:14:37 +0100
committerConnor Lane Smith2010-08-10 14:14:37 +0100
commit605e9b6c035979935f658c52938df56e2d0387ef (patch)
treeaa0b7fefaef8cedeb8740115dc0fbcf612405160 /dmenu.c
parentcaf524626894bdee3756c4065bca44152d0efe9a (diff)
reverted calcoffsets
Diffstat (limited to 'dmenu.c')
-rw-r--r--dmenu.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/dmenu.c b/dmenu.c
index 384def6..8384bc2 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -82,11 +82,12 @@ calcoffsets(void) {
else
n = mw - (promptw + inputw + textw(dc, "<") + textw(dc, ">"));
- for(i = 0, next = curr; i <= n && next; next = next->right)
- i += (lines > 0) ? LINEH : MIN(textw(dc, next->text), mw/3);
-
- for(i = 0, prev = curr; i <= n && prev && prev->left; prev = prev->left)
- i += (lines > 0) ? LINEH : MIN(textw(dc, prev->left->text), mw/3);
+ for(i = 0, next = curr; next; next = next->right)
+ if((i += (lines > 0) ? LINEH : MIN(textw(dc, next->text), mw/3)) > n)
+ break;
+ for(i = 0, prev = curr; prev && prev->left; prev = prev->left)
+ if((i += (lines > 0) ? LINEH : MIN(textw(dc, prev->left->text), mw/3)) > n)
+ break;
}
char *