From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27888 invoked by alias); 28 May 2018 12:42:59 -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: 42870 Received: (qmail 12066 invoked by uid 1010); 28 May 2018 12:42:59 -0000 X-Qmail-Scanner-Diagnostics: from rcpt-expgw.biglobe.ne.jp 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(133.208.98.4):SA:0(-2.6/5.0):. Processed in 1.08179 secs); 28 May 2018 12:42:59 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: takimoto-j@kba.biglobe.ne.jp X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Biglobe-Sender: From: "Jun T." Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [PATCH] another fix for 'compset -q' Message-Id: <9F5AAEAA-2E20-431E-879E-78732B6524A1@kba.biglobe.ne.jp> Date: Mon, 28 May 2018 21:42:54 +0900 To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.3273) X-Biglobe-Spnum: 61889 Another minor "improvement" of 'compset -q' It just avoids the warning in the example below; you can't get any useful completion either with or without the patch. zsh% zsh -c 'for (( i = 0; 5: compcore.c:1676: expecting 'x' at offset 6 of "i = 0" The cursor 'x' is not in the current word "i = 0" but in the next token. This indicates the function gotword() (lex.c) resets lexflags to 0 too early. I guess the global variable zlemetall (which is used in gotword()) need not count the 'x' added at the cursor, because get_cmp_string() (zle_tricky.c) also adds 'x' at the cursor by using addx() but does not increment zlemetall. It seems gotword() takes account of addedx by itself. If zlemetall is decremented by 1 (= addedx), then the wb and we returned by gotword() also decrease. So we need the 2nd hunk. diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index f733e0ee5..fd415da89 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -1610,9 +1610,11 @@ set_comp_sep(void) inpush(dupstrspace(tmp), 0, NULL); zlemetaline = tmp; /* - * Length of temporary string, calculated above. + * tl is the length of temporary string, calculated above. + * It seems zlemetall need not include the 'x' added at the cursor. + * addedx is taken care of in function gotword() (lex.c). */ - zlemetall = tl; + zlemetall = tl - addedx; strinbeg(0); noaliases = 1; do { @@ -1668,8 +1670,8 @@ set_comp_sep(void) DPUTS(!p, "no current word in substr"); got = 1; cur = countlinknodes(foo) - 1; /* cur is 0 offset */ - swb = wb - 1 - dq - sq - dolq; - swe = we - 1 - dq - sq - dolq; + swb = wb - dq - sq - dolq; + swe = we - dq - sq - dolq; sqq = lsq; soffs = zlemetacs - swb - css; DPUTS2(p[soffs] != 'x', "expecting 'x' at offset %d of \"%s\"",