Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bashcompinit incorrectly calculates COMP_LINE (proposed fix included)
- X-seq: zsh-workers 42038
- From: Evan Underscore <evanunderscore@xxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: bashcompinit incorrectly calculates COMP_LINE (proposed fix included)
- Date: Mon, 20 Nov 2017 09:55:45 +1100
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=kOa5jufZox/lYNTWksCeEgsBavsLyJsLEJTT7W+IomA=; b=RO0OmyEzLNRR6tWKYI5jw1GhaxtncVfrf8GdRoTGVMu+CvnANDLbCYg1MKt55Sqthu DmMW3ltPP2oqMceWJVcHOqW680pzQ3fATszlpptmkon3IRrUz3K2blDOEtvFlw3W0jyp IDAb/3y5+kejYHufSWAv00xP1shDmqcS44UTDogq3SqcGKeuSoplSWX+P7QB/igX8spX Zr10dYgdkzq3Ib/ZJbbdraej5tb9cUTgYjuVDUnoRKKA2jUv8CgCcyjSYFpbezTejrnY D4hAR/meAunska8+x8HSezhh36wFAsXIBMu5dq7x1H1OY2NYQ6KfIu204Ld3yDtqfT5Y 9MfQ==
- In-reply-to: <20171119194940.74dd8cea@ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CACiQ9RGKzNXY+bpnGdXxvjUvvpnm+NipOiyxpOL2Ua-Wcv6sSw@mail.gmail.com> <20171119194940.74dd8cea@ntlworld.com>
- Sender: evan.andrews.au@xxxxxxxxx
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