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

Re: menu-select interactive mode



On 10 April 2011 20:50, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Apr 10,  5:37pm, Mikael Magnusson wrote:
> }
> } Intuitively I feel like the very place that checks if the 'menu' style
> } contains 'select' should also check if the widget is called
> } 'menu-select'.
>
> The only other possibility is a few lines farther up, like so:
>
> Index: Completion/Base/Core/_main_complete
> ===================================================================
> RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/Base/Core/_main_complete,v
> retrieving revision 1.12
> diff -c -r1.12 _main_complete
> --- _main_complete      21 Dec 2010 16:41:14 -0000      1.12
> +++ _main_complete      10 Apr 2011 18:22:22 -0000
> @@ -260,7 +260,7 @@
>       fi
>     fi
>     if [[ "$MENUSELECT" != 00 ]]; then
> -      sel=( "${(@M)_menu_style:#select*}" )
> +      sel=( "${(@M)_menu_style:#select*}" ${(M)WIDGET#menu-select} )
>
>       if (( $#sel )); then
>        min=9999999
>
> That has the effect of setting MENUSELECT=0 as if the style had been
> set, but the side-effect is that MENUSELECT *remains* set to 0 after
> _main_complete finishes, which my other patch doesn't do (both leave
> MENUMODE set).
>
> } menu-complete doesn't imply selection, does it?
>
> No, but you wrote "using menu-complete" so I wanted to be sure what
> behavior you were expecting.

Oops, I must have meant menu-select, but if I didn't it clearly
explains why it didn't work yesterday.

> } > There are still some bugs in the interactive mode.
> }
> } Yeah, I noticed a couple of things too, if you complete some levels of
> } directories and accept, then undo it all, you're left with the bits
> } you typed manually, only the completion-inserted parts are removed.
>
> Hmm.  I don't know whether the right thing would be to add those to the
> undo system or something else.  Internally menu-select is handling it's
> own undos; I'm not familiar enough with how the undo entries are kept
> to know if extraneous entries would confuse things.

Just to clarify, I exited menu-select before doing the undo stuff.
What I sort of expected to happen was for the undo to remove the whole
thing in one step.

> } You can also not use more complex patterns than a simple * or ?, as
> } soon as you type a non-matching glob it drops you back into the main
> } shell.
>
> Yes, menu-select exits any time the number of matching completions is
> zero after any single key press, and an incomplete glob pattern is
> one such circumstance.

This strikes me as less than useful, I might have a look at it :).

> } Even if you manage to type a ( or | it will just start
> } completing commands or worse instead of files :).
>
> Actually for me it starts completing glob qualifiers.

That was "or worse".

Another thing I noticed was that the character to the left of the
cursor (or is that under the cursor?) gets suffix-highlighted when
interactive menu-completion starts, even a space that isn't part of
the resulting completion (this won't be visible with the default bold
style since a bold space is very similar to a regular space). This
then goes away when you start doing stuff. To see it, you have to make
sure no new text is inserted by starting the menu-selection.

-- 
Mikael Magnusson



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