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

Re: menu-select interactive mode



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.

} > There are still some bugs in the interactive mode.

I just managed to hit a really alarming one.  Starting zsh -f with
the ESC-m binding we've been discussing:

torch% MENUSELECT=0 MENUMODE=interactive

Next hit TAB after ls:

torch% ls
BUILD              config.log         Etc/               Src/             
Completion/        config.modules     Functions/         stamp-h          
Config/            config.modules.sh  local              stamp-h.in       
config.h           config.status*     Makefile           Test/            
config.h-xx        Doc/               sleep              ul*              

Now hit TAB again to enter menu completion:

torch% ls BUILD
BUILD              config.log         Etc/               Src/             
Completion/        config.modules     Functions/         stamp-h          
Config/            config.modules.sh  local              stamp-h.in       
config.h           config.status*     Makefile           Test/            
config.h-xx        Doc/               sleep              ul*              

And TAB again:

torch% ls Completion/
BUILD              config.log         Etc/               Src/
Completion/        config.modules     Functions/         stamp-h
Config/            config.modules.sh  local              stamp-h.in
config.h           config.status*     Makefile           Test/
config.h-xx        Doc/               sleep              ul*

Now hit ESC-m to enter menu-selection.  I'm not even going to attempt
to copy-paste the result, it's a screenful of garbage memory contents.

} 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.

} 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.

} 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.

} I don't know if this is a bug or not, the documentation doesn't really
} say what you can type in it.

It's pretty much exactly as if every alternate keystroke was a TAB,
and as soon as one of those returns no matches it bails out.



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