zsh-workers
 help / color / mirror / code / Atom feed
* Bug + patch: _expand() fails to insert unambiguous prefix
@ 2021-03-04 19:49 Marlon Richert
  2021-03-20  1:50 ` Lawrence Velázquez
  0 siblings, 1 reply; 7+ messages in thread
From: Marlon Richert @ 2021-03-04 19:49 UTC (permalink / raw)
  To: Zsh hackers list

Test case:
```
cd $(mktemp -d)
exec zsh -f
autoload -Uz compinit; compinit
zstyle ':completion:*' completer _expand _complete
zstyle ':completion:*' tag-order '! original all-expansions'
zstyle ':completion:*' show-ambiguity yes
bindkey '^I' complete-word
touch bar baz
file ^I
file *^I
```

Patch:
```
diff --git Completion/Base/Core/_main_complete
Completion/Base/Core/_main_complete
index 663f755..ec2d954 100644
--- Completion/Base/Core/_main_complete
+++ Completion/Base/Core/_main_complete
@@ -248,11 +248,10 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then
         ( -n "$_menu_style[(r)select=long-list]" ||
           -n "$_menu_style[(r)(yes|true|on|1)=long-list]" ) ]]; then
     compstate[insert]=menu
-  elif [[ "$compstate[insert]" = "$_saved_insert" ]]; then
-    if [[ -n "$compstate[insert]" &&
+  elif [[ -n "$compstate[insert]" &&
       -n "$_menu_style[(r)(yes|true|1|on)=long]" && tmp -gt LINES ]]; then
     compstate[insert]=menu
-    else
+  elif [[ -n "$_saved_insert" && -n "$compstate[insert]" ]]; then
       sel=( "${(@M)_menu_style:#(yes|true|1|on)*}" )

     if (( $#sel )); then
@@ -291,15 +290,18 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then
     fi
     if [[ ( -n "$min" && nm -ge min && ( -z "$max" || nm -lt max ) ) ||
           ( -n "$_menu_style[(r)auto*]" &&
-              "$compstate[insert]" = automenu ) ]]; then
+              "$_saved_insert" = automenu ) ]]; then
       compstate[insert]=menu
     elif [[ -n "$max" && nm -ge max ]]; then
       compstate[insert]=unambiguous
     elif [[ -n "$_menu_style[(r)auto*]" &&
-              "$compstate[insert]" != automenu ]]; then
+              "$_saved_insert" != automenu ||
+            "$PREFIX$SUFFIX" != *"$compstate[unambiguous]"* ]]; then
       compstate[insert]=automenu-unambiguous
+    elif [[ -z "$compstate[old_list]" ]]; then
+      compstate[insert]=
     fi
-    fi
+    compstate[list]="${compstate[list]/ambiguous/list}"
   fi

   if [[ "$compstate[insert]" = *menu* ]]; then
```


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-21  9:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-04 19:49 Bug + patch: _expand() fails to insert unambiguous prefix Marlon Richert
2021-03-20  1:50 ` Lawrence Velázquez
2021-03-20 11:20   ` Marlon Richert
2021-03-20 14:42     ` Lawrence Velázquez
2021-03-20 18:22       ` Marlon Richert
2021-03-20 20:54       ` Oliver Kiddle
2021-03-21  9:49         ` Marlon Richert

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).