diff options
-rw-r--r-- | dmenu.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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; | 133 | int x = 0, y = 0, w, inputscheme; |
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,18 +138,27 @@ 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; | ||
141 | } | 142 | } |
142 | /* draw input field */ | 143 | /* draw input field */ |
143 | w = (lines > 0 || !matches) ? mw - x : inputw; | 144 | w = (lines > 0 || !matches) ? mw - x : inputw; |
144 | drw_setscheme(drw, scheme[SchemeNorm]); | 145 | if (matches && !strcmp(text, curr->text)) |
146 | inputscheme = SchemeSel; | ||
147 | else | ||
148 | inputscheme = SchemeNorm; | ||
149 | drw_setscheme(drw, scheme[inputscheme]); | ||
150 | |||
145 | drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0); | 151 | drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0); |
146 | 152 | ||
147 | drw_font_getexts(drw->fonts, text, cursor, &curpos, NULL); | 153 | drw_font_getexts(drw->fonts, text, cursor, &curpos, NULL); |
148 | if ((curpos += lrpad / 2 - 1) < w) { | 154 | if ((curpos += lrpad / 2 - 1) < w) { |
149 | drw_setscheme(drw, scheme[SchemeNorm]); | 155 | drw_setscheme(drw, scheme[inputscheme]); |
150 | drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0); | 156 | drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0); |
151 | } | 157 | } |
152 | 158 | ||
159 | if (inputscheme == SchemeSel) | ||
160 | goto drawmap; | ||
161 | |||
153 | if (lines > 0) { | 162 | if (lines > 0) { |
154 | /* draw vertical list */ | 163 | /* draw vertical list */ |
155 | for (item = curr; item != next; item = item->right) | 164 | for (item = curr; item != next; item = item->right) |
@@ -171,6 +180,7 @@ drawmenu(void) | |||
171 | drw_text(drw, mw - w, 0, w, bh, lrpad / 2, ">", 0); | 180 | drw_text(drw, mw - w, 0, w, bh, lrpad / 2, ">", 0); |
172 | } | 181 | } |
173 | } | 182 | } |
183 | drawmap: | ||
174 | drw_map(drw, win, 0, 0, mw, mh); | 184 | drw_map(drw, win, 0, 0, mw, mh); |
175 | } | 185 | } |
176 | 186 | ||