Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Completion of prefix redirections is -command- instead of -redirect-



On Wed, 26 Aug 2015 22:14:13 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> The below seems to make it better, the only case that is still wrong
> after this is "foo < ; <tab>".  But I haven't more than minimally
> checked that completing in e.g. "for" loops still works properly.
> 
> diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
> index cb17bde..97bdcc0 100644
> --- a/Src/Zle/zle_tricky.c
> +++ b/Src/Zle/zle_tricky.c
> @@ -1185,7 +1185,7 @@ get_comp_string(void)
>  	 * relatively harmless by itself, it's probably incomplete.
>  	 */
>  	linredir = (inredir && !ins);
> -	lincmd = !linredir &&
> +	lincmd = !inredir &&
>  	    ((incmdpos && !ins && !incond) ||
>  	     (oins == 2 && wordpos == 2) ||
>  	     (ins == 3 && wordpos == 1) ||

That certainly ought to be on the right lines.  I would vaguely imagine
the incond and inredir ought to be doing roughly the same job, so maybe
if this works !incond should be pulled out.  The oins / ins / wordpos are
doing the cleverness with complex commands that no one quite
understands, which probably don't apply to either redirections or
conditions.

(You'd think there was a better way to do this using a state machine of
some sort.  There's a project for someone.)

pws



Messages sorted by: Reverse Date, Date, Thread, Author