From f01188ec2ad14165c8e580826721cbb71c49e2a2 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sun, 9 Nov 2014 17:33:02 +0100 Subject: 33639: fix bug with vi operators on a blank line and with backward bracket matching --- ChangeLog | 3 +++ Src/Zle/zle_vi.c | 12 +++--------- Test/X02zlevi.ztst | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index e51ed35c3..7fbb44e15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2014-11-09 Oliver Kiddle + * 33639: Src/Zle/zle_vi.c, Test/X02zlevi.ztst: fix bug with vi + operators on a blank line and with backward bracket matching + * 33659: Completion/Unix/Command/_gpg: use --dump-options to get most of the gpg options to complete diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c index d74b40d62..a60caa2b4 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 561a5fd73..7e5385bfe 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 -- cgit 1.4.1