From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26328 invoked by alias); 19 Nov 2017 20:01:00 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42037 Received: (qmail 2937 invoked by uid 1010); 19 Nov 2017 20:01:00 -0000 X-Qmail-Scanner-Diagnostics: from know-smtprelay-omc-1.server.virginmedia.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(80.0.253.65):SA:0(-3.1/5.0):. Processed in 7.924031 secs); 19 Nov 2017 20:01:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: p.w.stephenson@ntlworld.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Originating-IP: [86.21.219.59] X-Authenticated-User: p.w.stephenson@ntlworld.com X-Spam: 0 X-Authority: v=2.1 cv=UdSsM/mN c=1 sm=1 tr=0 a=utowdAHh8RITBM/6U1BPxA==:117 a=utowdAHh8RITBM/6U1BPxA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=x7bEGLp0ZPQA:10 a=pGLkceISAAAA:8 a=AbjPCLoj_VnXAwGcBEAA:9 a=CjuIK1q_8ugA:10 Date: Sun, 19 Nov 2017 19:49:40 +0000 From: Peter Stephenson To: Evan Underscore , zsh-workers@zsh.org Subject: Re: bashcompinit incorrectly calculates COMP_LINE (proposed fix included) Message-ID: <20171119194940.74dd8cea@ntlworld.com> In-Reply-To: References: X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1511120982; bh=E4h/dA6MvhI9ZQHfjjPDGBb0miL+yFNqJzki2AK6LNg=; h=Date:From:To:Subject:In-Reply-To:References; b=RwPxE/rq/IfsKo1OZP7dgYEU35tAM0BnEdMRq+5Pw53IYhS/GR1c0DQ66r5s15n1g bVg5y44l6h877p68Lyic03skTUrwnrihtGRfUZSS+m0aukUENkomwGeg+CdDbouWlz au7xUA+jt20IoWjRRo96DyfWuZFuvRlAl5wKrVX0Iq80QZVneQwiCVOyESbvU03EUw eYsv0hIi6dsTGi6iznKTR0yUs+xs9uJmzr6BithbpoPfRUb7Y4djW1L+BHlZQUk9wE 9pFQf9Mgy4P/jjeGyzX+zrhG+BiUWU5n0drgYIW73YdlEXGeEHmFeFrzpac+jw2fSm 9Kai63Ilgc35w== On Fri, 17 Nov 2017 20:19:25 +1100 Evan Underscore 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 )