about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-08-09 18:40:54 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-08-09 18:40:54 +0100
commit249999cfb485914fe6f8630b1f4079e1227a5097 (patch)
treee5ed7a10759dfdabacea798e909de27cf05e07dd
parent1122d83a6e508ddec5c6a9a04918a3646c667463 (diff)
downloadzsh-249999cfb485914fe6f8630b1f4079e1227a5097.tar.gz
zsh-249999cfb485914fe6f8630b1f4079e1227a5097.tar.xz
zsh-249999cfb485914fe6f8630b1f4079e1227a5097.zip
36025: Fix completion aftoer "foo=bar; setopt ".
Done by catching a case that doesn't seem to be handled otherwise,
so there's some hope it doesn't screw up too much.
-rw-r--r--ChangeLog8
-rw-r--r--Src/Zle/zle_tricky.c16
2 files changed, 21 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index a6cd577ed..8248e9b12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-08-09  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 36025:Src/Zle/zle_tricky.c: Catch another case of context in
+	get_comp_string():  after "foo=bar; setopt " we didn't recognise
+	"setopt" as the command.  Attempt to do this without actually
+	understanding what the command context code is attempting to do
+	after a command separator.
+
 2015-08-08  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* 36008: Src/builtin.c: trap: Fix listing of traps created
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 3bf8d4572..b87b99b00 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1175,9 +1175,19 @@ get_comp_string(void)
     do {
         qsub = noword = 0;
 
-	lincmd = ((incmdpos && !ins && !incond) ||
-		  (oins == 2 && wordpos == 2) ||
-		  (ins == 3 && wordpos == 1));
+	/*
+	 * pws: added cmdtok == NULLTOK test as fallback for detecting
+	 * we haven't had a command yet.  This is a cop out: it's needed
+	 * after SEPER because of bizarre and incomprehensible dance
+	 * that we otherwise do involving the "ins" flag when you might
+	 * have thought we'd just reset everything because we're now
+	 * considering a new command.  Consequently, although this looks
+	 * relatively harmless by itself, it's probably incomplete.
+	 */
+	lincmd = (incmdpos && !ins && !incond) ||
+	    (oins == 2 && wordpos == 2) ||
+	    (ins == 3 && wordpos == 1) ||
+	    (cmdtok == NULLTOK && !incond);
 	linredir = (inredir && !ins);
 	oins = ins;
 	/* Get the next token. */