summary refs log tree commit diff
diff options
context:
space:
mode:
-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