zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Re: Bad Variable Completion in test-2
@ 1999-07-20  8:40 Sven Wischnowsky
  0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 1999-07-20  8:40 UTC (permalink / raw)
  To: zsh-workers


Vin Shelton wrote:

> There seems to be a bug in accept-and-menu-complete in test-2:
> 
> : ~ Tue 20 0:51; /usr/local/zsh-3.1.6-test-2/bin/zsh -f
> mithril% bindkey '^X\t' accept-and-menu-complete
> mithril% echo $ZSH_<TAB><TAB>^X<TAB>
> 
> This results in:
> 
> mithril% echo $ZSH_NAME $$ZSH_VERSION
> 
> Note the '$$' - not what was intended.

That's with old style completion. The patch also fixes a problem with
new style completion when the match had a suffix.

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Tue Jul 20 08:54:19 1999
+++ Src/Zle/zle_tricky.c	Tue Jul 20 10:28:06 1999
@@ -565,8 +565,9 @@
 	cs = minfo.pos + minfo.len + minfo.insc;
 	iremovesuffix(' ', 1);
 	l = cs;
-	cs = minfo.pos + minfo.len - (*(minfo.cur))->qisl;
-	foredel(l - cs);
+	cs = minfo.pos + minfo.len + minfo.insc - (*(minfo.cur))->qisl;
+	if (cs < l)
+	    foredel(l - cs);
 	inststrlen(" ", 1, 1);
 	if (parpre)
 	    inststr(parpre);
@@ -801,11 +802,12 @@
 		parq = eparq = 0;
 
 	    /* Save the prefix. */
-	    sav = *b;
-	    *b = '\0';
-	    untokenize(parpre = ztrdup(s));
-	    *b = sav;
-
+	    if (incompfunc) {
+		sav = *b;
+		*b = '\0';
+		untokenize(parpre = ztrdup(s));
+		*b = sav;
+	    }
 	    /* And adjust wb, we, and offs again. */
 	    offs -= b - s;
 	    wb = cs - offs;

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-07-20  8:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-20  8:40 PATCH: Re: Bad Variable Completion in test-2 Sven Wischnowsky

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).