Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Three questions about a completer
- X-seq: zsh-users 21913
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Three questions about a completer
- Date: Wed, 14 Sep 2016 21:49:24 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=FuPNdgfvvlYT/XuiVMLp8dn1XQv/OBhHMtpyBLZpJH0=; b=tgY1vtyLCYQmkDx9NrRqNrKnIk4TZpD5YzwPSir7gfwlKFLBCoJAd4JLPB1VWzt86l 2YccKiNvLmOApH5/KwlfMEDWbN6pWpShX2qH9iEZQef8kXeBAfL33/l38Y4Yw4OfG2/4 14Dg6NKxLbvtGe+LRXZkqotxFsF992MJZMntVwPz7XQ9ElhFYQwJwFYwP4q8s7UPq9C+ /FjTNM0WVHaE0EIo2qWjFSQfQZvs2k1qxImEXlQ0wTtiaOk69hNIGYKNUKbuFms5JgP7 SjYh6rZPql57bd+zreM9eTCau48Wh0bWHVuk/Sj1jq/w376xIh9DDXJH/Am+5L5EQlIO NJew==
- In-reply-to: <CABZhJg9RR-8kJpfoiBn=0GpjK2fVWNk-Zuz09=CBkbB=AdEnaQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CABZhJg-VR4ss0KpxLvUnrUS7JnTVGGdSWePH7NzCzQvdimMubg@mail.gmail.com> <75335.1473713583@hydra.kiddle.eu> <CABZhJg_kVjB4Wb1FH2xb7=dB8wU4pLLa8H7Jf4+p-Mahjv3wPA@mail.gmail.com> <CABZhJg_4b6GiCo1J3BHzL0ACwao5Q_-HQgnhuHjQowUF+FVemQ@mail.gmail.com> <160913195916.ZM30431@torch.brasslantern.com> <CABZhJg-GPxn87gHX4+z-Md2kN7Wq4Ay=6db_uW762-4PQ9dKsA@mail.gmail.com> <160914093903.ZM29711@torch.brasslantern.com> <CABZhJg9RR-8kJpfoiBn=0GpjK2fVWNk-Zuz09=CBkbB=AdEnaQ@mail.gmail.com>
On Sep 14, 10:32pm, Jesper Nygards wrote:
}
} Hmm, this was much harder than I thought. I see no difference with the
} addition of the compstate[insert] line.
Hm. I don't have any problem making what you posted in users/21901
switch forward to backward or backward to forward, even without the
compstate[insert] assignment (as borne out by you finding it already
set to "menu" on entry).
I don't see where you've ever told us what version number of zsh you
have ... oh.
Date: Mon Mar 7 13:15:40 2016 +0100
38043: allow any completion widget to cycle matches for menu completion
to fix reverse menu completion
So it works for me because I'm running the most recent dev build.
That means you'll have to do a bit of the work of preserving the menu:
typeset -Hga __lsmatches
_list-result () {
if [[ $WIDGET != $LASTWIDGET ]]
then
if [[ $LASTWIDGET = *list-comp ]]
then
# Rotate stored completions to start in the right place
# Replace (b) with (q) here if zsh complains about (b)
integer here=$__lsmatches[(I)${(b)words[CURRENT]}]
if ((here)); then
__lsmatches=( $__lsmatches[here,-1] $__lsmatches[1,here-1] )
fi
else
# Store the matching completions in case needed again
compadd -O __lsmatches \
-M 'l:|=* m:{[:lower:]}={[:upper:]}' -f ${__lsdir:-HOME}/*
fi
# Now add, preserving the order previously calculated
compadd -V $WIDGET -U -f -a __lsmatches
fi
compstate[list]=''
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author