commit f342a0ca4d879a2e3061b007467e894c2e8211cb
parent f5a1c0aefd3c00226db4279264f2e6fbc1e43062
Author: Kris Maglione <jg@suckless.org>
Date: Mon, 13 Oct 2008 23:10:20 -0400
[menu] Place bar on top if wmii does so
Diffstat:
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/cmd/menu/menu.c b/cmd/menu/menu.c
@@ -51,6 +51,17 @@ menu_unmap(long id, void *p) {
XFlush(display);
}
+static char*
+histtext(Item *i) {
+ static char *orig;
+
+ if(!histidx->string) {
+ free(orig);
+ orig = strdup(filter);
+ }
+ return i->string ? i->string : orig;
+}
+
static void
menu_cmd(int op) {
bool res;
@@ -71,14 +82,14 @@ menu_cmd(int op) {
break;
case HIST_NEXT:
if(histidx->next) {
+ strncpy(filter, histtext(histidx->next), sizeof filter);
histidx = histidx->next;
- strncpy(filter, histidx->string, sizeof filter);
}
break;
case HIST_PREV:
if(histidx->prev) {
+ strncpy(filter, histtext(histidx->prev), sizeof filter);
histidx = histidx->prev;
- strncpy(filter, histidx->string, sizeof filter);
}
break;
case KILL_CHAR: