zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Patch available for 3.0.6-pre-0
Date: Fri, 23 Apr 1999 16:13:23 +0200 (MET DST)	[thread overview]
Message-ID: <199904231413.QAA02940@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Sven Wischnowsky's message of Fri, 23 Apr 1999 14:48:27 +0200 (MET DST)


I wrote:

> I seem to remember that one of the
> patches I sent after 4988 (which is the last entry with my name in it
> in the ChangeLog) fixed something that might be buggy in
> 3.0.[56]. Unfortunately I forgot to write myself a note about this and
> I can't remember what it was.

I found /them/:

 - Completion inside $((...)) didn't work -- see message 5799.
 - The other fix was hidden in 5564: at the end of makecomplist(),
   `addmatches' is set and then a couple of `dumphashtable()'s may be
   called and also some `addmatch()'es directly. Since
   `dumphashtable()' sets `addwhat' but doesn't restore it this may
   sometimes have the wrong value. Most significantly, if you have
   `compctl -vb foo', `foo <TAB>' seg-faults.

The patch also avoids some `suggest brace around ambiguous else'
messages.

Bye
 Sven

--- Src/zle_tricky.c.old	Thu Apr 22 09:04:42 1999
+++ Src/zle_tricky.c	Fri Apr 23 16:05:34 1999
@@ -578,7 +578,7 @@
 	    if (*q == Equals) {
 		/* The word starts with `=', see if we can expand it. */
 		q = s + 1;
-		if (cmdnamtab->getnode(cmdnamtab, q) || hashcmd(q, pathchecked))
+		if (cmdnamtab->getnode(cmdnamtab, q) || hashcmd(q, pathchecked)) {
 		    if (isset(RECEXACT))
 			lst = COMP_EXPAND;
 		    else {
@@ -600,6 +600,7 @@
 			if (n == 1)
 			    lst = COMP_EXPAND;
 		    }
+		}
 	    }
 	    if (lst == COMP_EXPAND_COMPLETE)
 		do {
@@ -708,11 +709,12 @@
 		if (*p == Tilde || *p == Equals)
 		    p++;
 		for (; *p; p++)
-		    if (itok(*p))
+		    if (itok(*p)) {
 			if (*p != String && *p != Qstring)
 			    *p = ztokens[*p - Pound];
 			else if (p[1] == Inbrace)
 			    p++, skipparens(Inbrace, Outbrace, &p);
+		    }
 		docompletion(s, lst, lincmd, 1);
 	    }
 	} else
@@ -1017,12 +1019,16 @@
 	    if (parend >= 0 && !tmp)
 		line = (unsigned char *) dupstring(tmp = (char *)line);
 	    linptr = (char *) line + ll + addedx - parbegin + 1;
-	    if (parend >= 0) {
-		ll -= parend;
-		line[ll + addedx] = '\0';
+
+	    if ((linptr - (char *) line) < 2 ||
+		linptr[-1] != '(' || linptr[-2] != '$') {
+		if (parend >= 0) {
+		    ll -= parend;
+		    line[ll + addedx] = '\0';
+		}
+		lexrestore();
+		goto start;
 	    }
-	    lexrestore();
-	    goto start;
 	}
 
 	if (inwhat == IN_MATH)
@@ -1272,7 +1278,7 @@
 			   *u == (char)bangchar) ||
 	     (instring == 2 &&
 	      (*u == '$' || *u == '`' || *u == '\"')) ||
-	     (instring == 1 && *u == '\'')))
+	     (instring == 1 && *u == '\''))) {
 	    if (*u == '\n' || (instring == 1 && *u == '\'')) {
 		if (unset(RCQUOTES)) {
 		    *v++ = '\'';
@@ -1287,6 +1293,7 @@
 		continue;
 	    } else
 		*v++ = '\\';
+	}
 	if(*u == Meta)
 	    *v++ = *u++;
 	*v++ = *u;
@@ -1923,14 +1930,14 @@
 dumphashtable(HashTable ht, int what)
 {
     HashNode hn;
-    int i;
+    int i, aw = addwhat;
 
     addwhat = what;
 
     for (i = 0; i < ht->hsize; i++)
 	for (hn = ht->nodes[i]; hn; hn = hn->next)
 	    addmatch(hn->nam, (char *) hn);
-
+    addwhat = aw;
 }
 
 /* ScanFunc used by maketildelist() et al. */
@@ -3342,7 +3349,7 @@
 	    menuend = ll;
 	if (menuend && ((((char)line[menuend - 1]) != singlec) ||
 	    (menuend > 1 && singlec == ' ' &&
-	      (line[menuend - 2] == '\\' || line[menuend - 2] == STOUC(Meta)))))
+	     (line[menuend - 2] == '\\' || line[menuend - 2] == STOUC(Meta))))) {
 	    if (parampre && singlec == '/' && ((char)line[menuend]) == '/')
 		addedsuffix = 0;
 	    /* Now insert the slash or space if there is none already. */
@@ -3357,6 +3364,7 @@
 		if (!menuwe)
 		    cs = ccs;
 	    }
+	}
     }
     /* Move to the end of the word if requested. */
     if (isset(ALWAYSTOEND) || menuwe)
@@ -3664,7 +3672,7 @@
 	if (t1 != colsz - 1 || !clearflag)
 	    putc('\n', shout);
     }
-    if (clearflag)
+    if (clearflag) {
 	/* Move the cursor up to the prompt, if always_last_prompt *
 	 * is set and all that...                                  */
 	if (up < lines) {
@@ -3672,6 +3680,7 @@
 	    showinglist = -1;
 	} else
 	    clearflag = 0, putc('\n', shout);
+    }
 }
 
 /* This is used to print expansions. */

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


             reply	other threads:[~1999-04-23 14:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-23 14:13 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-04-23 12:48 Sven Wischnowsky
1999-04-21  8:15 Bart Schaefer
1999-04-21  8:47 ` Peter Stephenson
1999-04-21 14:14 ` Tatsuo Furukawa
1999-04-21 16:05   ` Bart Schaefer
1999-04-22 15:07     ` Tatsuo Furukawa
1999-04-24  5:53       ` Bart Schaefer
1999-04-25  6:57         ` Geoff Wing
1999-04-26 15:22           ` Tatsuo Furukawa
1999-04-27 16:24             ` Bart Schaefer
1999-04-21 23:52 ` Wayne Davison
1999-04-24  4:32   ` Bart Schaefer
1999-04-24  7:12     ` Wayne Davison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199904231413.QAA02940@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).