summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDenis Vlasenko2008-06-22 16:38:53 +0000
committerDenis Vlasenko2008-06-22 16:38:53 +0000
commite3eae0d445a59b2165de57108e5ec46d231d144a (patch)
tree566e199bc7992e23ee051482521235dce83bfa34 /editors
parent50b5cac59f5140a980824cdeb03b477ca588be6e (diff)
downloadbusybox-e3eae0d445a59b2165de57108e5ec46d231d144a.zip
busybox-e3eae0d445a59b2165de57108e5ec46d231d144a.tar.gz
vi: fix obvious thinko's
Diffstat (limited to 'editors')
-rw-r--r--editors/vi.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 024a1db..f2f1fec 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -1274,9 +1274,8 @@ static void sync_cursor(char *d, int *row, int *col)
// 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 @@ static char *begin_line(char *p) // return pointer to first char cur line
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 *dollar_line(char *p) // return pointer to just before NL line
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 *prev_line(char *p) // return pointer first char prev line
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;
}