[BusyBox] VI

Richard Kojedzinszky krichy at tvnetwork.hu
Sat Jan 17 22:45:20 UTC 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

I dont know if someone has already discovered this bug or not, but i write
it down:
i just opened a file for editing, with busybox's vi, entered insert mode,
and pressed the 'END' button some times. And i saw that with everytime i
press that, it jumps to the next line's end. I suppose this is a bug.

Another was, when issuing the command 'cw' at the last line's last word,
and no spaces after that word, then the word's last char stayed in the
buffer. Maybe this is another bug?

I use the 1.00-pre5 busybox dist, and posted a patch which fixes these two
bugs maybe.

I hope i not missed anything. :)

Best regards,
Kojedzinszky Richard
TvNetWork Rt.
E-mail: krichy at tvnetwork.hu
PGP: 0x24E79141
  Fingerprint = 6847 ECFF EF58 0C09 18A5  16CF 270F 0C6F 24E7 9141
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6

iD8DBQFACbsEJw8MbyTnkUERApmqAJ9+6QAbMvKA+P6cZvVNCWzhOPoG6ACcD8JA
XeV6NZ84Zhxoc/vqcDamU/c=
=texM
-----END PGP SIGNATURE-----
-------------- next part --------------
diff -ruNP busybox-1.00-pre5/editors/vi.c busybox-1.00-pre5.vi/editors/vi.c
--- busybox-1.00-pre5/editors/vi.c	Mon Sep 15 10:33:36 2003
+++ busybox-1.00-pre5.vi/editors/vi.c	Sat Jan 17 23:09:21 2004
@@ -1669,7 +1669,9 @@
 		q = dot;
 	} else if (strchr("wW", c)) {
 		do_cmd(c);		// execute movement cmd
-		if (dot > text)
+		// 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 (dot > text && *dot == '\n')
 			dot--;		// stay off NL
@@ -3197,7 +3199,7 @@
 		if (cmdcnt-- > 1) {
 			do_cmd(c);
 		}				// repeat cnt
-		dot = end_line(dot + 1);
+		dot = end_line(dot);
 		break;
 	case '%':			// %- find matching char of pair () [] {}
 		for (q = dot; q < end && *q != '\n'; q++) {


More information about the busybox mailing list