[hackers] [wmii] [menu] Place bar on top if wmii does so || Kris Maglione

From: <hg_AT_suckless.org>
Date: Tue, 14 Oct 2008 03:15:46 +0000 (UTC)

changeset: 2357:d94404435dbc
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Oct 13 23:10:20 2008 -0400
files: cmd/menu/menu.c
description:
[menu] Place bar on top if wmii does so

diff -r 6ec813e716d1 -r d94404435dbc cmd/menu/menu.c
--- a/cmd/menu/menu.c Mon Oct 13 23:06:43 2008 -0400
+++ b/cmd/menu/menu.c Mon Oct 13 23:10:20 2008 -0400
@@ -51,6 +51,17 @@
         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 @@
                 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:
Received on Tue Oct 14 2008 - 03:15:46 UTC

This archive was generated by hypermail 2.2.0 : Tue Oct 14 2008 - 03:24:04 UTC