zsh-workers
 help / color / mirror / code / Atom feed
* compadd -Q -U completes $(( without inserting upon it
@ 2016-01-16 17:25 Sebastian Gniazdowski
  2016-01-16 22:55 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Gniazdowski @ 2016-01-16 17:25 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 902 bytes --]

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

[-- Attachment #2: compadd_test --]
[-- Type: application/octet-stream, Size: 119 bytes --]

PREFIX='open'
SUFFIX=''
IPREFIX=""
ISUFFIX=""
words=( 'open' )

builtin compadd -Q -U 'open 0 + 1 close'

# vim:ft=zsh

[-- Attachment #3: compadd_test2 --]
[-- Type: application/octet-stream, Size: 113 bytes --]

PREFIX='$(('
SUFFIX=''
IPREFIX=""
ISUFFIX=""
words=( '$((' )

builtin compadd -Q -U '$(( 0 + 1 ))'

# vim:ft=zsh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-17 15:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-16 17:25 compadd -Q -U completes $(( without inserting upon it Sebastian Gniazdowski
2016-01-16 22:55 ` Bart Schaefer
2016-01-17 15:21   ` Sebastian Gniazdowski

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).