aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2016-07-26 23:02:34 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2016-07-26 23:02:34 +0200
commitaa92cd68bdff95c181cc854043598e6c6007d45e (patch)
treeba95a01038cdf4ed7db37070c66c782800f4de30
parenta4053bc4e403ae57343f43b7e363a0911bba5a3a (diff)
Revert "Print highlighted input text only on single match"
This reverts commit a4053bc4e403ae57343f43b7e363a0911bba5a3a. My bad, was working on the wrong branch and accidently pushed it... *facepalm*
-rw-r--r--dmenu.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/dmenu.c b/dmenu.c
index b191486..8e84fbd 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -130,7 +130,7 @@ drawmenu(void)
130{ 130{
131 unsigned int curpos; 131 unsigned int curpos;
132 struct item *item; 132 struct item *item;
133 int x = 0, y = 0, w, inputscheme; 133 int x = 0, y = 0, w;
134 134
135 drw_setscheme(drw, scheme[SchemeNorm]); 135 drw_setscheme(drw, scheme[SchemeNorm]);
136 drw_rect(drw, 0, 0, mw, mh, 1, 1); 136 drw_rect(drw, 0, 0, mw, mh, 1, 1);
@@ -138,27 +138,18 @@ drawmenu(void)
138 if (prompt && *prompt) { 138 if (prompt && *prompt) {
139 drw_setscheme(drw, scheme[SchemeSel]); 139 drw_setscheme(drw, scheme[SchemeSel]);
140 x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0); 140 x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0);
141 x += 2;
142 } 141 }
143 /* draw input field */ 142 /* draw input field */
144 w = (lines > 0 || !matches) ? mw - x : inputw; 143 w = (lines > 0 || !matches) ? mw - x : inputw;
145 if (matches && !strcmp(text, curr->text)) 144 drw_setscheme(drw, scheme[SchemeNorm]);
146 inputscheme = SchemeSel;
147 else
148 inputscheme = SchemeNorm;
149 drw_setscheme(drw, scheme[inputscheme]);
150
151 drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0); 145 drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
152 146
153 drw_font_getexts(drw->fonts, text, cursor, &curpos, NULL); 147 drw_font_getexts(drw->fonts, text, cursor, &curpos, NULL);
154 if ((curpos += lrpad / 2 - 1) < w) { 148 if ((curpos += lrpad / 2 - 1) < w) {
155 drw_setscheme(drw, scheme[inputscheme]); 149 drw_setscheme(drw, scheme[SchemeNorm]);
156 drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0); 150 drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
157 } 151 }
158 152
159 if (inputscheme == SchemeSel)
160 goto drawmap;
161
162 if (lines > 0) { 153 if (lines > 0) {
163 /* draw vertical list */ 154 /* draw vertical list */
164 for (item = curr; item != next; item = item->right) 155 for (item = curr; item != next; item = item->right)
@@ -180,7 +171,6 @@ drawmenu(void)
180 drw_text(drw, mw - w, 0, w, bh, lrpad / 2, ">", 0); 171 drw_text(drw, mw - w, 0, w, bh, lrpad / 2, ">", 0);
181 } 172 }
182 } 173 }
183drawmap:
184 drw_map(drw, win, 0, 0, mw, mh); 174 drw_map(drw, win, 0, 0, mw, mh);
185} 175}
186 176