[BusyBox-cvs] busybox/editors vi.c,1.31,1.32

Erik Andersen andersen at busybox.net
Wed Feb 4 11:19:46 UTC 2004


Update of /var/cvs/busybox/editors
In directory nail:/tmp/cvs-serv17664/editors

Modified Files:
	vi.c 
Log Message:
Richard Kojedzinszky writes:

Hi,

I've noticed the bug also, and here is another patch for it. I hope it'll
not introduce more bugs. Not too nice, but works for me.

Here it is for busybox-1.00-pre6



Index: vi.c
===================================================================
RCS file: /var/cvs/busybox/editors/vi.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- vi.c	21 Jan 2004 10:59:45 -0000	1.31
+++ vi.c	4 Feb 2004 11:19:44 -0000	1.32
@@ -1669,10 +1669,13 @@
 		q = dot;
 	} else if (strchr("wW", c)) {
 		do_cmd(c);		// execute movement cmd
-		// if we are at the next word's first char
-		// step back one char
-		if (dot > text && isspace(dot[-1]))
-			dot--;		// move back off of next word
+ 		// if we are at the next word's first char
+ 		// step back one char
+ 		// but check the possibilities when it is true
+ 		if (dot > text && ((isspace(dot[0]) && !isspace(dot[0]))
+ 				|| (ispunct(dot[-1]) && !ispunct(dot[0]))
+ 				|| (isalnum(dot[-1]) && !isalnum(dot[0]))))
+  			dot--;		// move back off of next word
 		if (dot > text && *dot == '\n')
 			dot--;		// stay off NL
 		q = dot;




More information about the busybox-cvs mailing list