summaryrefslogtreecommitdiff
path: root/Src/Zle/zle_move.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/zle_move.c')
-rw-r--r--Src/Zle/zle_move.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/Src/Zle/zle_move.c b/Src/Zle/zle_move.c
index fad6b0a5f..939cfb1d0 100644
--- a/Src/Zle/zle_move.c
+++ b/Src/Zle/zle_move.c
@@ -575,7 +575,8 @@ vimatchbracket(UNUSED(char **args))
if ((zlecs == zlell || zleline[zlecs] == '\n') && zlecs > 0)
DECCS();
-
+ if (virangeflag)
+ mark = zlecs;
otog:
if (zlecs == zlell || zleline[zlecs] == '\n') {
zlecs = ocs;
@@ -587,7 +588,6 @@ vimatchbracket(UNUSED(char **args))
oth = '}';
break;
case /*{*/ '}':
- virangeflag = -virangeflag;
dir = -1;
oth = '{'; /*}*/
break;
@@ -596,7 +596,6 @@ vimatchbracket(UNUSED(char **args))
oth = ')';
break;
case ')':
- virangeflag = -virangeflag;
dir = -1;
oth = '(';
break;
@@ -605,7 +604,6 @@ vimatchbracket(UNUSED(char **args))
oth = ']';
break;
case ']':
- virangeflag = -virangeflag;
dir = -1;
oth = '[';
break;
@@ -613,6 +611,8 @@ vimatchbracket(UNUSED(char **args))
INCCS();
goto otog;
}
+ if (virangeflag && dir < 0)
+ INCPOS(mark); /* include starting position when going backwards */
ct = 1;
while (zlecs >= 0 && zlecs < zlell && ct) {
if (dir < 0)
@@ -636,7 +636,7 @@ vimatchbracket(UNUSED(char **args))
int
viforwardchar(char **args)
{
- int lim = findeol() - invicmdmode() + virangeflag;
+ int lim = findeol();
int n = zmult;
if (n < 0) {
@@ -646,6 +646,8 @@ viforwardchar(char **args)
zmult = n;
return ret;
}
+ if (invicmdmode() && !virangeflag)
+ DECPOS(lim);
if (zlecs >= lim)
return 1;
while (n-- && zlecs < lim)