diff --git a/cmd/menu/menu.c b/cmd/menu/menu.c index baccb036..30a790c8 100644 --- a/cmd/menu/menu.c +++ b/cmd/menu/menu.c @@ -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); diff --git a/cmd/wmii.rc.rc b/cmd/wmii.rc.rc index 9e81ae23..773f86d7 100755 --- a/cmd/wmii.rc.rc +++ b/cmd/wmii.rc.rc @@ -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 diff --git a/rc/rc.wmii.rc b/rc/rc.wmii.rc index f5b95bc6..279b62ac 100755 --- a/rc/rc.wmii.rc +++ b/rc/rc.wmii.rc @@ -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 &