[menu] Proper accept semantics.

This commit is contained in:
Kris Maglione 2008-10-14 19:00:58 -04:00
parent f7567601a7
commit 98f66f5aaf
3 changed files with 14 additions and 9 deletions

View File

@ -87,10 +87,11 @@ next:
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 @@ kdown_event(Window *w, XKeyEvent *e) {
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 @@ kdown_event(Window *w, XKeyEvent *e) {
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);

View File

@ -49,6 +49,12 @@ fn wi_9menu {
-^(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} {
shift 2

View File

@ -219,9 +219,7 @@ key $MODKEY-a || fn $key {
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 @@ Action overridekeys
# 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 &