summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_move.c31
2 files changed, 28 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 13b5a188b..b8c22f46e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2012-08-13  Peter Stephenson  <pws@csr.com>
 
+	* Aaron Schrab: 30604: Src/Zle/zle_move.c: make repeating vi skip
+	character useful by ignoring character just matched.
+
 	* Aaron Schrab: 30603: Src/Zle/zle_move.c: repeating vi skip
 	characters commands caused bad positioning.
 
@@ -16482,5 +16485,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5687 $
+* $Revision: 1.5688 $
 *****************************************************
diff --git a/Src/Zle/zle_move.c b/Src/Zle/zle_move.c
index 284a86389..d5f464c2c 100644
--- a/Src/Zle/zle_move.c
+++ b/Src/Zle/zle_move.c
@@ -679,7 +679,7 @@ vifindnextchar(char **args)
     if ((vfindchar = vigetkey()) != ZLEEOF) {
 	vfinddir = 1;
 	tailadd = 0;
-	return virepeatfind(args);
+	return vifindchar(0, args);
     }
     return 1;
 }
@@ -691,7 +691,7 @@ vifindprevchar(char **args)
     if ((vfindchar = vigetkey()) != ZLEEOF) {
 	vfinddir = -1;
 	tailadd = 0;
-	return virepeatfind(args);
+	return vifindchar(0, args);
     }
     return 1;
 }
@@ -703,7 +703,7 @@ vifindnextcharskip(char **args)
     if ((vfindchar = vigetkey()) != ZLEEOF) {
 	vfinddir = 1;
 	tailadd = -1;
-	return virepeatfind(args);
+	return vifindchar(0, args);
     }
     return 1;
 }
@@ -715,14 +715,14 @@ vifindprevcharskip(char **args)
     if ((vfindchar = vigetkey()) != ZLEEOF) {
 	vfinddir = -1;
 	tailadd = 1;
-	return virepeatfind(args);
+	return vifindchar(0, args);
     }
     return 1;
 }
 
 /**/
 int
-virepeatfind(char **args)
+vifindchar(int repeat, char **args)
 {
     int ocs = zlecs, n = zmult;
 
@@ -735,6 +735,16 @@ virepeatfind(char **args)
 	zmult = n;
 	return ret;
     }
+    if (repeat && tailadd != 0) {
+	if (vfinddir > 0) {
+	    if(zlecs < zlell && (ZLE_INT_T)zleline[zlecs+1] == vfindchar)
+		INCCS();
+	}
+	else {
+	    if(zlecs > 0 && (ZLE_INT_T)zleline[zlecs-1] == vfindchar)
+		DECCS();
+	}
+    }
     while (n--) {
 	do {
 	    if (vfinddir > 0)
@@ -760,19 +770,26 @@ virepeatfind(char **args)
 
 /**/
 int
+virepeatfind(char **args)
+{
+    return vifindchar(1, args);
+}
+
+/**/
+int
 virevrepeatfind(char **args)
 {
     int ret;
 
     if (zmult < 0) {
 	zmult = -zmult;
-	ret = virepeatfind(args);
+	ret = vifindchar(1, args);
 	zmult = -zmult;
 	return ret;
     }
     tailadd = -tailadd;
     vfinddir = -vfinddir;
-    ret = virepeatfind(args);
+    ret = vifindchar(1, args);
     vfinddir = -vfinddir;
     tailadd = -tailadd;
     return ret;