Zsh Mailing List Archive
Messages sorted by:
Completion after assignment as command (Re: 5.0.9 eventually...?)
On Sun, 9 Aug 2015 23:45:00 +0900
"Jun T." <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
> 35852 ? Do you mean this?
> Subject: Completion bug after assignment,unset
> > zsh -f
> > autoload compinit && compinit
> > RPS2=$PS2; unset PS2 ; setopt <TAB>
> > completes files rather than options.
> In my case it completes commands (not files), while
> % a=b; setopt <TAB>
> completes files.
> I can't understand how get_comp_string() works, of course...
No one does, which is why it was changed in the slightly fudged way it
was to minimise the overall effect instead of to fix the probalem
The following improves things without any obvious side effect, maybe ---
I only just noticed the !incond thing at the last minute, which would
otherwise have screwed up completion in conditions which might have
taken a while to notice. Note I've remvoed some unnecessary parentheses
just as a very small concession to clartiy.
I don't understand the SEPER / ins handling except to the limited extent
I've noted in previous tortuous and frustrated comments. Any problems
with this? Anyone any idea how to add a test for it?
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 3bf8d45..b87b99b 100644
@@ -1175,9 +1175,19 @@ get_comp_string(void)
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. */
Messages sorted by: