[hackers] [wmii] [menu] Proper accept semantics. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Wed, 15 Oct 2008 20:09:01 +0000 (UTC)

changeset: 2367:81fd16a57752
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Oct 14 19:00:58 2008 -0400
files: cmd/menu/menu.c cmd/wmii.rc.rc rc/rc.wmii.rc
description:
[menu] Proper accept semantics.

diff -r 51de8e1fe0f1 -r 81fd16a57752 cmd/menu/menu.c
--- a/cmd/menu/menu.c Tue Oct 14 18:09:47 2008 -0400
+++ b/cmd/menu/menu.c Tue Oct 14 19:00:58 2008 -0400
@@ -87,10 +87,11 @@
         switch(op) {
         case ACCEPT:
                 srv.running = false;
- if(matchidx)
+ if(matchidx->retstring && !motion)
                         print("%s", matchidx->retstring);
                 else
- result = 1;
+ print("%s", input.string);
+
                 break;
         case REJECT:
                 srv.running = false;
@@ -258,7 +259,7 @@
                 case XK_J:
                 case XK_m:
                 case XK_M:
- menu_cmd(ACCEPT, 0);
+ menu_cmd(ACCEPT, e->state&ShiftMask);
                         return;
                 case XK_n:
                 case XK_N:
@@ -327,7 +328,7 @@
                 menu_cmd(REJECT, 0);
                 return;
         case XK_Return:
- menu_cmd(ACCEPT, 0);
+ menu_cmd(ACCEPT, e->state&ShiftMask);
                 return;
         case XK_BackSpace:
                 menu_cmd(KILL, CHAR);
diff -r 51de8e1fe0f1 -r 81fd16a57752 cmd/wmii.rc.rc
--- a/cmd/wmii.rc.rc Tue Oct 14 18:09:47 2008 -0400
+++ b/cmd/wmii.rc.rc Tue Oct 14 19:00:58 2008 -0400
@@ -48,6 +48,12 @@
                 -^(nf nb br)^$wmiinormcol \
                 -^(sf sb br)^$wmiifocuscol $*
 }
+
+fn wi_addhist {
+ file = $1 len=$2 { shift 2
+ { cat $file; echo $*; } | uniq | sed '/^$/d' \
+ | tail -$len >$file.$pid
+ mv $file.$pid $file}}
 
 fn wi_fnmenu {
         group=$1^Menu-$2 last=$group^_last fns=`{wi_getfuns $group} {
diff -r 51de8e1fe0f1 -r 81fd16a57752 rc/rc.wmii.rc
--- a/rc/rc.wmii.rc Tue Oct 14 18:09:47 2008 -0400
+++ b/rc/rc.wmii.rc Tue Oct 14 19:00:58 2008 -0400
@@ -219,9 +219,7 @@
 key $MODKEY-p || fn $key {
         ifs=() { cmd = `{wimenu -h $progs_hist <$progs_file} }
         wi_runcmd $cmd &
- { cat $progs_hist; echo $cmd; } | uniq | sed '/^$/d' \
- | tail -$progs_len >$progs_hist.$pid
- mv $progs_hist.$pid $progs_hist}
+ wi_addhist $hist.prog $histlen $cmd}
 key $MODKEY-Return || fn $key {
         wi_runcmd $WMII_TERM &}
 
@@ -251,8 +249,8 @@
 
 # Misc Setup
 progs_file=`{namespace}^/proglist.$pid
-progs_hist=`{namespace}^/proghist
-progs_len=5000
+hist=`{namespace}^/history
+histlen=5000
 touch $progs_hist
 Action status &
 Action rehash &
Received on Wed Oct 15 2008 - 20:09:01 UTC

This archive was generated by hypermail 2.2.0 : Wed Oct 15 2008 - 20:12:05 UTC