summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-11-09 17:33:02 +0100
committerOliver Kiddle <opk@zsh.org>2014-11-09 17:51:26 +0100
commitf01188ec2ad14165c8e580826721cbb71c49e2a2 (patch)
tree2e56586d30d06a4235214058a12ae7e2f0950213
parent82aa706cbf83928bd08226b19736cd6e4402b802 (diff)
downloadzsh-f01188ec2ad14165c8e580826721cbb71c49e2a2.tar.gz
zsh-f01188ec2ad14165c8e580826721cbb71c49e2a2.zip
33639: fix bug with vi operators on a blank line
and with backward bracket matching
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/zle_vi.c12
-rw-r--r--Test/X02zlevi.ztst15
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 <opk@zsh.org>
+ * 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