aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-22 16:38:53 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-22 16:38:53 +0000
commite3eae0d445a59b2165de57108e5ec46d231d144a (patch)
tree566e199bc7992e23ee051482521235dce83bfa34
parent50b5cac59f5140a980824cdeb03b477ca588be6e (diff)
downloadbusybox-w32-e3eae0d445a59b2165de57108e5ec46d231d144a.tar.gz
busybox-w32-e3eae0d445a59b2165de57108e5ec46d231d144a.tar.bz2
busybox-w32-e3eae0d445a59b2165de57108e5ec46d231d144a.zip
vi: fix obvious thinko's
-rw-r--r--editors/vi.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 024a1db94..f2f1fecde 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -1274,9 +1274,8 @@ static void sync_cursor(char *d, int *row, int *col)
1274 // handle tabs like real vi 1274 // handle tabs like real vi
1275 if (d == tp && cmd_mode) { 1275 if (d == tp && cmd_mode) {
1276 break; 1276 break;
1277 } else {
1278 co = next_tabstop(co);
1279 } 1277 }
1278 co = next_tabstop(co);
1280 } else if ((unsigned char)*tp < ' ' || *tp == 0x7f) { 1279 } else if ((unsigned char)*tp < ' ' || *tp == 0x7f) {
1281 co++; // display as ^X, use 2 columns 1280 co++; // display as ^X, use 2 columns
1282 } 1281 }
@@ -1326,7 +1325,7 @@ static char *begin_line(char *p) // return pointer to first char cur line
1326 return p; 1325 return p;
1327} 1326}
1328 1327
1329static char *end_line(char *p) // return pointer to NL of cur line line 1328static char *end_line(char *p) // return pointer to NL of cur line
1330{ 1329{
1331 if (p < end - 1) { 1330 if (p < end - 1) {
1332 p = memchr(p, '\n', end - p - 1); 1331 p = memchr(p, '\n', end - p - 1);
@@ -1348,7 +1347,7 @@ static char *dollar_line(char *p) // return pointer to just before NL line
1348static char *prev_line(char *p) // return pointer first char prev line 1347static char *prev_line(char *p) // return pointer first char prev line
1349{ 1348{
1350 p = begin_line(p); // goto begining of cur line 1349 p = begin_line(p); // goto begining of cur line
1351 if (p[-1] == '\n' && p > text) 1350 if (p > text && p[-1] == '\n')
1352 p--; // step to prev line 1351 p--; // step to prev line
1353 p = begin_line(p); // goto begining of prev line 1352 p = begin_line(p); // goto begining of prev line
1354 return p; 1353 return p;
@@ -1357,7 +1356,7 @@ static char *prev_line(char *p) // return pointer first char prev line
1357static char *next_line(char *p) // return pointer first char next line 1356static char *next_line(char *p) // return pointer first char next line
1358{ 1357{
1359 p = end_line(p); 1358 p = end_line(p);
1360 if (*p == '\n' && p < end - 1) 1359 if (p < end - 1 && *p == '\n')
1361 p++; // step to next line 1360 p++; // step to next line
1362 return p; 1361 return p;
1363} 1362}