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

Re: bashcompinit incorrectly calculates COMP_LINE (proposed fix included)



Yes, that patch works for me for the following test cases:

./demo.py new test[tab] (COMP_POINT=18)
./demo.py new test [tab] (COMP_POINT=19)
./demo.py new 你好嘚瑟[tab] (COMP_POINT=18)
./demo.py new 你好嘚瑟 [tab] (COMP_POINT=19)

Thanks.

On Mon, Nov 20, 2017 at 6:49 AM, Peter Stephenson <
p.w.stephenson@xxxxxxxxxxxx> wrote:

> On Fri, 17 Nov 2017 20:19:25 +1100
> Evan Underscore <evanunderscore@xxxxxxxxx> wrote:
> > Reverting this line (i.e. using CURRENT-1 instead of CURRENT, as it was
> > before this commit) fixes the bug for me, causing zsh to report 18 and 19
> > for the two test lines respectively, matching Bash.
>
> So I think so suggesting the following patch gives the correct behaviour
> under all circumstances you aware of?
>
> pws
>
>
> diff --git a/Completion/bashcompinit b/Completion/bashcompinit
> index 902fa88..02290a1 100644
> --- a/Completion/bashcompinit
> +++ b/Completion/bashcompinit
> @@ -8,7 +8,7 @@ _bash_complete() {
>    local -x COMP_LINE="$words"
>    local -A savejobstates savejobtexts
>
> -  (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT]}} + $#QIPREFIX +
> $#IPREFIX + $#PREFIX ))
> +  (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT-1]}} + $#QIPREFIX +
> $#IPREFIX + $#PREFIX ))
>    (( COMP_CWORD = CURRENT - 1))
>    COMP_WORDS=( $words )
>    BASH_VERSINFO=( 2 05b 0 1 release )
>


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