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

Re: Bug + patch: `zstyle ':completion:*' menu select=long-list` fails to start menu selection



On Thu, Mar 4, 2021 at 10:17 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> Thanks.  Haven't reviewed the patch, but assuming it's correct, it'd be
> great to have this test upgraded to a proper regression test; see
> Test/README in the source tree.

OK, I added a test to the patch, which fails before applying the patch
and succeeds afterwards. Please review.

diff --git Completion/Base/Core/_main_complete
Completion/Base/Core/_main_complete
index 663f7557..9d90b0fe 100644
--- Completion/Base/Core/_main_complete
+++ Completion/Base/Core/_main_complete
@@ -244,7 +244,7 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then

   _menu_style=( "$_menu_style[@]" "$_def_menu_style[@]" )

-  if [[ "$compstate[list]" = *list && tmp -gt LINES &&
+  if [[ "$compstate[list]" = *list(| *) && tmp -gt LINES &&
         ( -n "$_menu_style[(r)select=long-list]" ||
           -n "$_menu_style[(r)(yes|true|on|1)=long-list]" ) ]]; then
     compstate[insert]=menu
diff --git Test/Y01completion.ztst Test/Y01completion.ztst
index 65f341d4..02094cad 100644
--- Test/Y01completion.ztst
+++ Test/Y01completion.ztst
@@ -237,6 +237,40 @@ F:regression test workers/31611
 >FI:{file1}
 >FI:{file2}

+  comptesteval '_tst() { local disp=( {a..z} ); compadd -ld disp
$disp[@]; comppostfuncs=( _pst ) }'
+  comptesteval '_pst() { local disp=(
"<INSERT>$compstate[insert]</INSERT>" ); compadd -Qld disp $disp }'
+  comptesteval "zstyle ':completion:*' menu select=long-list"
+  comptest $'tst \C-d'
+0: menu select=long-list starts menu selection for list widgets
+>NO:{<INSERT>menu</INSERT>}
+>NO:{a}
+>NO:{b}
+>NO:{c}
+>NO:{d}
+>NO:{e}
+>NO:{f}
+>NO:{g}
+>NO:{h}
+>NO:{i}
+>NO:{j}
+>NO:{k}
+>NO:{l}
+>NO:{m}
+>NO:{n}
+>NO:{o}
+>NO:{p}
+>NO:{q}
+>NO:{r}
+>NO:{s}
+>NO:{t}
+>NO:{u}
+>NO:{v}
+>NO:{w}
+>NO:{x}
+>NO:{y}
+>NO:{z}
+
+
 %clean

   zmodload -ui zsh/zpty




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