From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12567 invoked by alias); 20 Oct 2014 17:32:51 -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: X-Seq: 33480 Received: (qmail 24769 invoked from network); 20 Oct 2014 17:32:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f6c6d00000120b-16-544544d99b2f Date: Mon, 20 Oct 2014 18:22:32 +0100 From: Peter Stephenson To: Zsh workers Subject: Re: bug with completion in quotes Message-id: <20141020182232.1e0e828b@pwslap01u.europe.root.pri> In-reply-to: <13524.1413067029@thecus.kiddle.eu> References: <13524.1413067029@thecus.kiddle.eu> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphluLIzCtJLcpLzFFi42I5/e/4Zd2bLq4hBh9XSlgcbH7I5MDoserg B6YAxigum5TUnMyy1CJ9uwSujA0bxQoe8lVcfvORsYFxE1cXIyeHhICJxPe/t9khbDGJC/fW s3UxcnEICSxllHh7/SorhLOcSeLM9V5WkCoWAVWJb2uOM4LYbAKGElM3zQazRYDic06cAqsR FtCSeH5/EguIzStgL7H/ywewDZwCBhJ7VzUwgdhCAvoS8yZ/ZAOx+YHsq38/MUFcYS8x88oZ RoheQYkfk++BzWEGmrl5WxMrhC0vsXnNW+YJjAKzkJTNQlI2C0nZAkbmVYyiqaXJBcVJ6bmG esWJucWleel6yfm5mxghIfhlB+PiY1aHGAU4GJV4eAUsXUKEWBPLiitzDzFKcDArifAqqLiG CPGmJFZWpRblxxeV5qQWH2Jk4uCUamDsVml3lGW9z1dlOaOmd9n7hlc/Y5iWdp3tFwngD9ry 41EX87q7M6/dOV1wNLgq/od4yPFD7KatjGtvc7QetLqr/e5PxgrdVVcuhv84PcFPlW2K7caz Tcd+faoS5Dv8WMv6zL1G194A1gybfXYaUd2Xzs34//2F9aszV/bcmjjf+Iw4/xuXpFXzlFiK MxINtZiLihMBV+8jUB8CAAA= See if this helps with some of the $'...' problems. Note that when the cursor is inside $'...' we deliberately don't try to expand the $'...'. That's not a change. Possibly we could do so, but we'd need to be careful about where the cursor ended up. diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index 499c4ae..5fa625a 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -662,8 +662,9 @@ docomplete(int lst) * NOTE: get_comp_string() calls pushheap(), but not popheap(). */ noerrs = 1; s = get_comp_string(); - DPUTS(wb < 0 || zlemetacs < wb || zlemetacs > we, - "BUG: 0 <= wb <= zlemetacs <= we is not true!"); + DPUTS3(wb < 0 || zlemetacs < wb || zlemetacs > we, + "BUG: 0 <= wb (%d) <= zlemetacs (%d) <= we (%d) is not true!", + wb, zlemetacs, we); noerrs = ne; /* For vi mode, reset the start-of-insertion pointer to the beginning * * of the word being completed, if it is currently later. Vi itself * @@ -1720,9 +1721,11 @@ get_comp_string(void) for (pe = p + 2; *pe && *pe != Snull && i + (pe - p) < zlemetacs; pe++) ; - if (!*pe) { + if (*pe != Snull) { /* no terminating Snull, can't substitute */ skipchars = 2; + if (*pe) + j = 1; } else { /* * Try and substitute the $'...' expression. @@ -1795,6 +1798,10 @@ get_comp_string(void) * first clue how the completion system actually works. */ skipchars = 2; + /* + * Also pretend we're in single quotes. + */ + j = 1; } } } @@ -1817,7 +1824,7 @@ get_comp_string(void) ocs = zlemetacs; zlemetacs = i; foredel(skipchars, CUT_RAW); - if ((zlemetacs = ocs) > (i -= skipchars)) + if ((zlemetacs = ocs) > i--) zlemetacs -= skipchars; we -= skipchars; } pws