summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2014-10-24 09:54:55 +0100
committerPeter Stephenson <pws@zsh.org>2014-10-24 09:54:55 +0100
commit11c3bc3d73c69d60ab88c1fd404fb37a35ee9f01 (patch)
tree7b59b2f902947fea7d3da70150a087628ce605e1 /Src
parent242b419fbc35b7807207e899e8275e0089d48121 (diff)
downloadzsh-11c3bc3d73c69d60ab88c1fd404fb37a35ee9f01.tar.gz
zsh-11c3bc3d73c69d60ab88c1fd404fb37a35ee9f01.tar.xz
zsh-11c3bc3d73c69d60ab88c1fd404fb37a35ee9f01.zip
33480, slightly tweaked: fix for $' completion.
Improves case where completing after the $' but before any
closing quote, or if the closing quote is absent.
No other change --- we still don't attempt to exand the quotes if
we're inside them.
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_tricky.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 499c4ae77..b15d91c8e 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -662,8 +662,9 @@ docomplete(int lst)
      * NOTE: get_comp_string() calls pushheap(), but not popheap(). */
     noerrs = 1;
     s = get_comp_string();
-    DPUTS(wb < 0 || zlemetacs < wb || zlemetacs > we,
-	  "BUG: 0 <= wb <= zlemetacs <= we is not true!");
+    DPUTS3(wb < 0 || zlemetacs < wb || zlemetacs > we,
+	  "BUG: 0 <= wb (%d) <= zlemetacs (%d) <= we (%d) is not true!",
+	   wb, zlemetacs, we);
     noerrs = ne;
     /* For vi mode, reset the start-of-insertion pointer to the beginning *
      * of the word being completed, if it is currently later.  Vi itself  *
@@ -1720,9 +1721,11 @@ get_comp_string(void)
 	    for (pe = p + 2; *pe && *pe != Snull && i + (pe - p) < zlemetacs;
 		 pe++)
 		;
-	    if (!*pe) {
+	    if (*pe != Snull) {
 		/* no terminating Snull, can't substitute */
 		skipchars = 2;
+		if (*pe)
+		    j = 1;
 	    } else {
 		/*
 		 * Try and substitute the $'...' expression.
@@ -1795,6 +1798,10 @@ get_comp_string(void)
 		     * first clue how the completion system actually works.
 		     */
 		    skipchars = 2;
+		    /*
+		     * Also pretend we're in single quotes.
+		     */
+		    j = 1;
 		}
 	    }
 	}
@@ -1817,7 +1824,7 @@ get_comp_string(void)
 		    ocs = zlemetacs;
 		    zlemetacs = i;
 		    foredel(skipchars, CUT_RAW);
-		    if ((zlemetacs = ocs) > (i -= skipchars))
+		    if ((zlemetacs = ocs) > --i)
 			zlemetacs -= skipchars;
 		    we -= skipchars;
 		}