svn commit: trunk/busybox/editors

vda at busybox.net vda at busybox.net
Sun Jun 22 16:38:54 UTC 2008


Author: vda
Date: 2008-06-22 09:38:53 -0700 (Sun, 22 Jun 2008)
New Revision: 22471

Log:
vi: fix obvious thinko's



Modified:
   trunk/busybox/editors/vi.c


Changeset:
Modified: trunk/busybox/editors/vi.c
===================================================================
--- trunk/busybox/editors/vi.c	2008-06-22 16:28:02 UTC (rev 22470)
+++ trunk/busybox/editors/vi.c	2008-06-22 16:38:53 UTC (rev 22471)
@@ -1274,9 +1274,8 @@
 			// handle tabs like real vi
 			if (d == tp && cmd_mode) {
 				break;
-			} else {
-				co = next_tabstop(co);
 			}
+			co = next_tabstop(co);
 		} else if ((unsigned char)*tp < ' ' || *tp == 0x7f) {
 			co++; // display as ^X, use 2 columns
 		}
@@ -1326,7 +1325,7 @@
 	return p;
 }
 
-static char *end_line(char *p) // return pointer to NL of cur line line
+static char *end_line(char *p) // return pointer to NL of cur line
 {
 	if (p < end - 1) {
 		p = memchr(p, '\n', end - p - 1);
@@ -1348,7 +1347,7 @@
 static char *prev_line(char *p) // return pointer first char prev line
 {
 	p = begin_line(p);	// goto begining of cur line
-	if (p[-1] == '\n' && p > text)
+	if (p > text && p[-1] == '\n')
 		p--;			// step to prev line
 	p = begin_line(p);	// goto begining of prev line
 	return p;
@@ -1357,7 +1356,7 @@
 static char *next_line(char *p) // return pointer first char next line
 {
 	p = end_line(p);
-	if (*p == '\n' && p < end - 1)
+	if (p < end - 1 && *p == '\n')
 		p++;			// step to next line
 	return p;
 }




More information about the busybox-cvs mailing list