From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6515 invoked by alias); 7 Nov 2014 23:57:42 -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: 33639 Received: (qmail 13050 invoked from network); 7 Nov 2014 23:57: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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1415404653; bh=XWpRQ/PgFkX3q5zY9TBtoWCtiTtBVFmaGsTOmjAnSRU=; h=From:To:Subject:Date:From:Subject; b=eHE69p7XAkZTMUrvrbKJMcG1yjRnokmnidCMp2o+Ar/hFikygLNK9E5k6Jn1hYeDQG0T6YfE7nZoASJ8QRYi/E/47/acKl+wnxKtdTu5+fsKMcg2e1syR6pk/CLo6sQZoPvRugGIq6M1VxjYCSWCK1PsqhL9LuugAQLWeB5FyOeenlHzTCAAFDkDbywnJ76hIQoztvtEvt4pttxgSzSNWvnIWoF86Lx7IJAEx669KFg0i0HZOZ6j7IO/TYsyycN5YgYh33Ca4v/AEx1O/ym12tMxbBRNabQO/iNUwLE8o27dsPc0q1WwS+iSku3hE7/n7XkahLH3DhzJEhFhN8XVMw== DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.co.uk; b=kTaHx8tQdsDCkdcE2cnYplI0flDzILbS5T35POJU3nhsVaqG+4aQzy1vFyxnovlPvmYDUwUS7wVsykXiEnctK8RwS1acQAk6MPEFPWj9eurgqSXA14vuYRuRwh3F7IzyMgtSe7kdcLa7RnnglOeq0BohDn7c2Ms8szdwnboPzzi7znt9a6+Xm+yAiJJdt+u9HPuKBMJN/QVjZ3U6o40XqDk60CTPOc94Go6aYl7kezh2WNNqeHlqX42JxEHoM/JWYYeNvvwte06QEGAAenKRnL0Ev4zDkApBMTDEnZnXzY7sirW6d4vvjEyHcspw7OE6/GN+yL89JQNOheHjpsCWHw==; X-Yahoo-Newman-Id: 924532.16044.bm@smtp147.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: Doo7GZYVM1nulAEJXAi8TzbgAoozlq2TYclcNLaC8jXqXnD aeL5.LjxDeyKrvORUvv3cZX7FY8dbg4npbxtbPRl8.FlEzAvWuVpKKdu4.2I 0QXaZ265BpXDVjgXS2bP47DfTpYzo8mQxzL5HR2_LMZNBhpRd2gaBneYGTFT V7BdOI6VbPrAgoRUulpXVb3E5S4PZjwa3E5S_9sokyfyRUxt.Up6n0yurGkb gAMl8L22dSEIhlgKLXztc.KdxlKI52EYexKvHzNfXKOz0umnnY.xUVooyjFY Z5TA9EZb1TFDfJDR18MF0VTCFMLHBqBq7LJqmMlohccSHwaVheQRQnQpJBzA RYJdPXiZTURFEdbochHR8NWV6.fGxQSJyoti55RAQagjyg51TcTPvdFDYEjr sMp9FF1RmrY5KGbwfXSxw2aXksKJsHymvaNX4xji8W.jhyJ2syDULa.gBMe2 zgfAdWuWt.hm0QRigMZFZHztqakEvzxR.A.XEg3Cq64MAv3s0ITZnJpWECZB 7V1Rn.y9eLG.6XAB1SKkpihog91DNaw-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- From: Oliver Kiddle To: Zsh workers Subject: PATCH: fix ancient bug with empty lines MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15752.1415404652.1@thecus.kiddle.eu> Date: Sat, 08 Nov 2014 00:57:32 +0100 Message-ID: <15753.1415404652@thecus.kiddle.eu> I wrote: > There's an existing old bug with blank lines: dd on a blank line doesn't > work. It works in 3.0.8 but not in 4.2.1. It was broken early in the 3.1 branch, definitely before 1997. The problem is that virangeflag was being reset. This will have been done so some of the up-line-or-history style commands can tell whether they're being used from vi operators. Unfortunately this was done too early losing values being passed back. For empty lines, the value of 2 indicates that getvirange should accept the lack of movement because the empty line is being selected. Furthermore, a value of -1 is used for vi-match-bracket to indiciate that a cursor adjustment is required. This was also broken: a backward movement with % was missing one character. It is still broken for yy. This is a separate problem: we want to cut zero bytes but set CUTBUFFER_LINE. I'm not sure how to fix that exactly. Oliver diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c index d74b40d..a60caa2 100644 --- a/Src/Zle/zle_vi.c +++ b/Src/Zle/zle_vi.c @@ -202,7 +202,6 @@ getvirange(int wf) zmult = mult1 * zmod.tmult; } while(prefixflag && !ret); wordflag = 0; - virangeflag = 0; /* It is an error to use a non-movement command to delimit the * * range. We here reject the case where the command modified * @@ -222,14 +221,9 @@ getvirange(int wf) /* vi-match-bracket changes the value of virangeflag when * * moving to the opening bracket, meaning that we need to * * change the *starting* position. */ - if(virangeflag == -1) - { - int origcs = zlecs; - zlecs = pos; - INCCS(); - pos = zlecs; - zlecs = origcs; - } + if (virangeflag == -1) + INCPOS(pos); + virangeflag = 0; /* Get the range the right way round. zlecs is placed at the * * start of the range, and pos (the return value of this * diff --git a/Test/X02zlevi.ztst b/Test/X02zlevi.ztst index 561a5fd..7e5385b 100644 --- a/Test/X02zlevi.ztst +++ b/Test/X02zlevi.ztst @@ -15,6 +15,21 @@ >BUFFER: good >CURSOR: 4 + zletest $'{ ({[}]) }\e0c%chg' +0:change forward to matching bracket +>BUFFER: chg +>CURSOR: 3 + + zletest $'s( match )\ed%' +0:delete backwards to matching bracket +>BUFFER: s +>CURSOR: 0 + + zletest $'one\eo\edd' +0:delete empty line +>BUFFER: one +>CURSOR: 0 + zletest $' four\eO\C-v\tthree\eO two\eOone\e3J' 0:join lines with line count >BUFFER: one two three