summaryrefslogtreecommitdiffstats
path: root/dmenu.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dmenu.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/dmenu.c b/dmenu.c
index 7dfc2d3..608023d 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -42,6 +42,7 @@ static void setup(void);
static void usage(void);
static char text[4096];
+static int promptw;
static size_t cursor = 0;
static const char *prompt = NULL;
static const char *normbgcolor = "#cccccc";
@@ -79,7 +80,7 @@ void
calcoffsetsh(void) {
unsigned int w, x;
- w = (prompt ? textw(dc, prompt) : 0) + inputw + textw(dc, "<") + textw(dc, ">");
+ w = promptw + inputw + textw(dc, "<") + textw(dc, ">");
for(x = w, next = curr; next; next = next->right)
if((x += MIN(textw(dc, next->text), mw / 3)) > mw)
break;
@@ -118,7 +119,7 @@ drawmenu(void) {
dc->y = topbar ? 0 : mh - dc->h;
/* print prompt? */
if(prompt) {
- dc->w = textw(dc, prompt);
+ dc->w = promptw;
drawtext(dc, prompt, selcol);
dc->x = dc->w;
}
@@ -506,7 +507,9 @@ setup(void) {
grabkeyboard();
setcanvas(dc, win, mw, mh);
inputw = MIN(inputw, mw/3);
+ promptw = prompt ? MIN(textw(dc, prompt), mw/5) : 0;
XMapRaised(dc->dpy, win);
+ text[0] = '\0';
match();
}
2015-01-19Add plumbing functionality.Gravatar Christoph Lohmann 2-2/+28 2015-01-18Add a comment about how the styles are iterated.Gravatar Christoph Lohmann 1-0/+4 2015-01-18My CMD was too short. :OGravatar Christoph Lohmann 1-1/+1 2015-01-17Add the manpage changes for the disk cache support.Gravatar Christoph Lohmann 1-1/+7 2015-01-17Adding disk cache support for soup.Gravatar Christoph Lohmann 2-9/+40 2015-01-17Fix extra newline, and add -g where other switches are forwarded.Gravatar Ben Woolley 1-1/+3 2015-01-17Newer libc want _DEFAULT_SOURCE.Gravatar Christoph Lohmann 1-1/+1 2015-01-17Major styles update.Gravatar Christoph Lohmann 3-11/+84 2015-01-02Fix a typo in surf manual.Gravatar Jakukyo Friel 1-1/+1 2014-09-28Minor style change.Gravatar Christoph Lohmann 1-1/+1 2014-09-28Make »Copy image address« work.Gravatar Christoph Lohmann 1-3/+10 2014-08-07Mention xdotool in SEE ALSO too.Gravatar Christoph Lohmann 1-1/+2 2014-08-07Fix the manpage about xid.Gravatar Christoph Lohmann 1-1/+3