[hackers] [dmenu] ignore prompt if it is empty in addition to NULL || Moritz Wilhelmy

From: <hg_AT_suckless.org>
Date: Tue, 15 May 2012 13:23:09 +0200 (CEST)

changeset: 488:6b2b356f9b49
tag: tip
user: Moritz Wilhelmy <moritz+hg_AT_wzff.de>
date: Tue May 15 11:47:54 2012 +0200
files: dmenu.c
description:
ignore prompt if it is empty in addition to NULL


diff -r dc4b49011838 -r 6b2b356f9b49 dmenu.c
--- a/dmenu.c Fri Apr 06 16:38:01 2012 +0100
+++ b/dmenu.c Tue May 15 11:47:54 2012 +0200
_AT_@ -169,7 +169,7 @@
         dc->h = bh;
         drawrect(dc, 0, 0, mw, mh, True, BG(dc, normcol));
 
- if(prompt) {
+ if(prompt && *prompt) {
                 dc->w = promptw;
                 drawtext(dc, prompt, selcol);
                 dc->x = dc->w;
_AT_@ -579,7 +579,7 @@
                 y = topbar ? 0 : DisplayHeight(dc->dpy, screen) - mh;
                 mw = DisplayWidth(dc->dpy, screen);
         }
- promptw = prompt ? textw(dc, prompt) : 0;
+ promptw = (prompt && *prompt) ? textw(dc, prompt) : 0;
         inputw = MIN(inputw, mw/3);
         match();
 
Received on Tue May 15 2012 - 13:23:09 CEST

This archive was generated by hypermail 2.3.0 : Tue May 15 2012 - 13:24:06 CEST