Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Completion oddities



On Mon, Dec 11, 2023 at 4:28 PM Oliver Kiddle <opk@xxxxxxx> wrote:
>
> Bart Schaefer wrote:
> > Maybe I'm just confused.
> >
> > #1
> > It appears that setting MENUSELECT globally, overrides the "no-select"
> > string in the "menu" zstyle.
>
> The menu selection was built to work even with compctl completion.
> MENUSELECT is the interface _main_complete uses to control it. So the
> way it is doesn't surprise me.

It's inconsistent, though.  If you use no-select by itself, it kills
MENUSELECT.  And the doc suggests that it should always prevail:

     Menu selection can be turned off explicitly by defining a value
     containing the string 'no-select'.

> > #2
> > When the "original" style is true for _approximate and _correct, the
> > REC_EXACT option seems to be ignored.  Is there a way around that?
>
> While you've since posted a solution, I've not managed to construct an
> example to demonstrate the difference.

I had an example but it's long since scrolled out of my terminal history.

> > #4
> > The way that the function field of a context is computed is a bit
> > annoying.  For example, if I call
> >     zle _correct_word
> > from _generic, then instead of the widget name in the function slot,
> > the function is correct-word.  This makes it impossible to specify
> > styles for the widget separately from styles for using _correct_word
> > directly. It's done this way by a large number of functions.
> >
>
> How are you calling `zle _correct_word` from _generic?

Sorry, I mis-"spoke" there.  I meant "from a generic widget" not
literally "_generic".

The initial widget is not a zle -C widget, it's a zle -N that fiddles
around with $BUFFER, sets up $curcontext, and then runs "zle
_correct_word".

But given this:

if [[ -z "$curcontext" ]]; then
  curcontext="correct-word:::"
else
  curcontext="correct-word:${curcontext#*:}"
fi

I don't see how the function context can ever be anything other than
"correct-word", even if it was started from _generic?  Unless the
style is tested either before _correct_word is called or after it
returns.




Messages sorted by: Reverse Date, Date, Thread, Author