Subject: compadd -Q -U completes $(( without inserting upon it
From: Sebastian Gniazdowski <[email-masked]>
To: Zsh hackers list <[email-masked]>
Date: Sat, 16 Jan 2016 18:25:14 +0100
List-Id: Zsh Workers List <zsh-workers.zsh.org>

Hello,
I have two completers, first one:

PREFIX='open'
SUFFIX=''
IPREFIX=""
ISUFFIX=""
words=( 'open' )
builtin compadd -Q -U 'open 0 + 1 close'

second one:
PREFIX='$(('
SUFFIX=''
IPREFIX=""
ISUFFIX=""
words=( '$((' )
builtin compadd -Q -U '$(( 0 + 1 ))'

With first one, if I do "open<TAB>", I get: "open 0 + 1 close". With
second one, when I do "$((<TAB>", I get "$(($(( 0 + 1 ))'.

This looks like zsh source has embedded tweaks to make math
($compstate[context] is "math" in second case) completing work more
reasonably. Is there a way to overcome this?

Video:
https://asciinema.org/a/9o1wwp76t0z2j2fz15aoucwym

To test the attached files:

autoload compadd_test ; zle -N compadd_test
autoload compadd_test2 ; zle -N compadd_test2

then:

zstyle ':completion:*' completer compadd_test _complete

or:

zstyle ':completion:*' completer compadd_test2 _complete

Best regards,
Sebastian Gniazdowski