zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Evan Underscore <evanunderscore@gmail.com>, zsh-workers@zsh.org
Subject: Re: bashcompinit incorrectly calculates COMP_LINE (proposed fix included)
Date: Sun, 19 Nov 2017 19:49:40 +0000	[thread overview]
Message-ID: <20171119194940.74dd8cea@ntlworld.com> (raw)
In-Reply-To: <CACiQ9RGKzNXY+bpnGdXxvjUvvpnm+NipOiyxpOL2Ua-Wcv6sSw@mail.gmail.com>

On Fri, 17 Nov 2017 20:19:25 +1100
Evan Underscore <evanunderscore@gmail.com> 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 )


  reply	other threads:[~2017-11-19 20:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17  9:19 Evan Underscore
2017-11-19 19:49 ` Peter Stephenson [this message]
2017-11-19 22:55   ` Evan Underscore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171119194940.74dd8cea@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=evanunderscore@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).