summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-03-21 09:29:52 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2015-03-21 09:29:52 -0700
commit8254c9c071bff087c3d52a5ac2811b5b7fc367ce (patch)
tree85174c547acb451c3b876a8218d5e7ad0a36201e
parenta74fe69d0550a37625f73f3008f8f468207536f4 (diff)
downloadzsh-8254c9c071bff087c3d52a5ac2811b5b7fc367ce.tar.gz
zsh-8254c9c071bff087c3d52a5ac2811b5b7fc367ce.tar.xz
zsh-8254c9c071bff087c3d52a5ac2811b5b7fc367ce.zip
users/20034: adjust PREFIX and SUFFIX for unambiguous_cursor on second completion attempt with GLOB_COMPLETE
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Base/Core/_main_complete10
2 files changed, 16 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index af0d54b2e..bc7ac80d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-21  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* users/20034: Completion/Base/Core/_main_complete: adjust
+	PREFIX and SUFFIX for unambiguous_cursor on second completion
+	attempt with GLOB_COMPLETE
+
 2015-03-20  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 34753 / 34754: Test/C02cond.ztst: work around lack
diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete
index d6a100777..977ab49ee 100644
--- a/Completion/Base/Core/_main_complete
+++ b/Completion/Base/Core/_main_complete
@@ -68,6 +68,16 @@ if [[ "$compstate[insert]" = tab* ]]; then
   compstate[insert]="${compstate[insert]//tab /}"
 fi
 
+# Second attempt at GLOB_COMPLETE
+
+if [[ "$compstate[pattern_match]" = "*" &&
+      "$_lastcomp[unambiguous]" = "$PREFIX" &&
+      -n "$_lastcomp[unambiguous_cursor]" ]]; then
+  integer upos="$_lastcomp[unambiguous_cursor]"
+  SUFFIX="$PREFIX[upos,-1]$SUFFIX"
+  PREFIX="$PREFIX[1,upos-1]"
+fi
+
 # Special completion contexts after `~' and `='.
 
 if [[ -z "$compstate[quote]" ]]; then