mirror of https://github.com/0intro/wmii
Fix ticket #114.
This commit is contained in:
parent
4b2c11bc79
commit
772b49c6a6
|
@ -8,6 +8,8 @@ static Handlers handlers;
|
|||
|
||||
static int ltwidth;
|
||||
|
||||
static void _menu_draw(bool);
|
||||
|
||||
enum {
|
||||
ACCEPT = CARET_LAST,
|
||||
REJECT,
|
||||
|
@ -51,6 +53,15 @@ menu_unmap(long id, void *p) {
|
|||
XFlush(display);
|
||||
}
|
||||
|
||||
static void
|
||||
selectitem(Item *i) {
|
||||
if(i != matchidx) {
|
||||
caret_set(input.filter_start, input.pos - input.string);
|
||||
caret_insert(i->retstring, 0);
|
||||
matchidx = i;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
menu_cmd(int op, int motion) {
|
||||
int n;
|
||||
|
@ -86,38 +97,35 @@ next:
|
|||
caret_move(op, motion);
|
||||
break;
|
||||
case CMPL_NEXT:
|
||||
matchidx = matchidx ? matchidx->next : matchfirst;
|
||||
selectitem(matchidx ? matchidx->next : matchfirst);
|
||||
break;
|
||||
case CMPL_PREV:
|
||||
if(!matchidx)
|
||||
matchidx = matchfirst;
|
||||
matchidx = matchidx->prev;
|
||||
selectitem((matchidx ? matchidx : matchstart)->prev);
|
||||
break;
|
||||
case CMPL_FIRST:
|
||||
matchstart = matchfirst;
|
||||
matchidx = matchstart;
|
||||
matchend = nil;
|
||||
selectitem(matchstart);
|
||||
break;
|
||||
case CMPL_LAST:
|
||||
matchidx = matchfirst->prev;
|
||||
selectitem(matchfirst->prev);
|
||||
break;
|
||||
case CMPL_NEXT_PAGE:
|
||||
matchidx = matchend->next;
|
||||
if(matchend)
|
||||
selectitem(matchend->next);
|
||||
break;
|
||||
case CMPL_PREV_PAGE:
|
||||
matchend = matchstart->prev;
|
||||
matchidx = nil;
|
||||
_menu_draw(false);
|
||||
selectitem(matchstart);
|
||||
break;
|
||||
}
|
||||
if(matchidx) {
|
||||
caret_set(input.filter_start, input.pos - input.string);
|
||||
caret_insert(matchidx->retstring, 0);
|
||||
}
|
||||
menu_draw();
|
||||
}
|
||||
|
||||
void
|
||||
menu_draw(void) {
|
||||
static void
|
||||
_menu_draw(bool draw) {
|
||||
Rectangle r, rd, rp, r2;
|
||||
CTuple *c;
|
||||
Item *i;
|
||||
|
@ -163,6 +171,9 @@ menu_draw(void) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!draw)
|
||||
return;
|
||||
|
||||
r2 = rd;
|
||||
for(i=matchstart; i->string; i=i->next) {
|
||||
r2.min.x = promptw + itemoff;
|
||||
|
@ -203,6 +214,11 @@ menu_draw(void) {
|
|||
copyimage(barwin, r, ibuf, ZP);
|
||||
}
|
||||
|
||||
void
|
||||
menu_draw(void) {
|
||||
_menu_draw(true);
|
||||
}
|
||||
|
||||
void
|
||||
menu_show(void) {
|
||||
Rectangle r;
|
||||
|
|
|
@ -227,10 +227,10 @@ key $MODKEY-Return || fn $key {
|
|||
wi_runcmd $WMII_TERM &}
|
||||
|
||||
key $MODKEY-t || fn $key {
|
||||
wmiir xwrite /ctl view `{wi_tags | wimenu -h $hist.tag -n 50} &}
|
||||
tag=`{wi_tags | wimenu -h $hist.tag -n 50} && wmiir xwrite /ctl view $tag &}
|
||||
key $MODKEY-Shift-t || fn $key {
|
||||
sel = `{wi_selclient} \
|
||||
wmiir xwrite /client/$sel/tags `{wi_tags | wimenu -h $hist.tag -n 50} &}
|
||||
sel=`{wi_selclient} {
|
||||
tag=`{wi_tags | wimenu -h $hist.tag -n 50} && wmiir xwrite /client/$sel/tags $tag } &}
|
||||
|
||||
key $MODKEY-^`{seq 0 9} || fn $key {
|
||||
wmiir xwrite /ctl view `{echo $1 | sed 's/.*-//'}}
|
||||
|
|
Loading…
Reference in New Issue