about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPaul Ackersviller <packersv@users.sourceforge.net>2007-11-24 22:55:12 +0000
committerPaul Ackersviller <packersv@users.sourceforge.net>2007-11-24 22:55:12 +0000
commita82e0c770fb9543b0d9eb0ce36d9e4d0feb59356 (patch)
tree7511f2421249a547e939a3672fc62a0d88ae77ae /Src
parent449183fd1bd70a6c6a82d6aba9a3b5daa770a262 (diff)
downloadzsh-a82e0c770fb9543b0d9eb0ce36d9e4d0feb59356.tar.gz
zsh-a82e0c770fb9543b0d9eb0ce36d9e4d0feb59356.tar.xz
zsh-a82e0c770fb9543b0d9eb0ce36d9e4d0feb59356.zip
Merge of 23757: suppress correction of command words followed by ().
Diffstat (limited to 'Src')
-rw-r--r--Src/lex.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/Src/lex.c b/Src/lex.c
index e91cecfbc..2bd21d7bf 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -66,7 +66,12 @@ int isfirstch;
 /**/
 int inalmore;
 
-/* don't do spelling correction */
+/*
+ * Don't do spelling correction.
+ * Bit 1 is only valid for the current word.  It's
+ * set when we detect a lookahead that stops the word from
+ * needing correction.
+ */
  
 /**/
 int nocorrect;
@@ -347,6 +352,7 @@ yylex(void)
     do
 	tok = gettok();
     while (tok != ENDINPUT && exalias());
+    nocorrect &= 1;
     if (tok == NEWLIN || tok == ENDINPUT) {
 	while (hdocs) {
 	    struct heredocs *next = hdocs->next;
@@ -622,7 +628,7 @@ isnumglob(void)
 }
 
 /**/
-int
+static int
 gettok(void)
 {
     int c, d;
@@ -1029,8 +1035,16 @@ gettokstr(int c, int sub)
 		     *   pws 1999/6/14
 		     */
 		    if (e == ')' || (isset(SHGLOB) && inblank(e) && !bct &&
-				     !brct && !intpos && incmdpos))
+				     !brct && !intpos && incmdpos)) {
+			/*
+			 * Either a () token, or a command word with
+			 * something suspiciously like a ksh function
+			 * definition.
+			 * The current word isn't spellcheckable.
+			 */
+			nocorrect |= 2;
 			goto brk;
+		    }
 		}
 		/*
 		 * This also handles the [k]sh `foo( )' function definition.