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

PATCH: Re: SUFFIX problem.



Tanaka Akira wrote:

> Z(4):akr@serein% zsh -f
> serein% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
> serein% _tst () { print -lr - "$SUFFIX" }
> serein% setopt listpacked rcquotes completeinword
> serein% tst '<TAB>a''<TAB>
> ->
> serein% tst '
> a''ackeda''''
> 
> SUFFIX has broken value.

Urgh. With rcquotes set, the lexer gave the completion code the string 
with the thinned out quotes (i.e. only one quote in the string), but
reported the positions relative to the whole string on the line.

Bye
 Sven

Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.8
diff -u -r1.8 zle_tricky.c
--- Src/Zle/zle_tricky.c	2000/05/09 11:04:45	1.8
+++ Src/Zle/zle_tricky.c	2000/05/15 09:49:50
@@ -1326,10 +1326,12 @@
 	autoq = ztrdup(q);
     }
     /* While building the quoted form, we also clean up the command line. */
-    for (p = s, tt = qword, i = wb; *p; p++, tt++, i++)
+    for (p = s, tt = qword, i = wb, j = 0; *p; p++, tt++, i++)
 	if (INULL(*p)) {
 	    if (i < cs)
 		offs--;
+	    if (*p == Snull)
+		j = 1-j;
 	    if (p[1] || *p != Bnull) {
 		if (*p == Bnull) {
 		    *tt = '\\';
@@ -1356,7 +1358,8 @@
 		we--;
 	    }
 	    chuck(p--);
-	}
+	} else if (j && *p == '\'' && i < cs)
+	    offs--;
 
     zsfree(origword);
     origword = ztrdup(s);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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