diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-12 00:51:15 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-12 00:51:15 +0200 |
commit | 1302892a14e8660b1f577f2cde710103c366d413 (patch) | |
tree | 7be79d94302f7c84269249c697f6b15eaf37dc28 /libbb/lineedit.c | |
parent | fda8f57360aaf24dba3784aae4818f5a351f5c7d (diff) | |
download | busybox-w32-1302892a14e8660b1f577f2cde710103c366d413.tar.gz busybox-w32-1302892a14e8660b1f577f2cde710103c366d413.tar.bz2 busybox-w32-1302892a14e8660b1f577f2cde710103c366d413.zip |
vi: small code shrink
function old new delta
vi_word_motion 185 165 -20
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r-- | libbb/lineedit.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index ab3297220..6e836d83e 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1296,8 +1296,10 @@ vi_word_motion(int eat) | |||
1296 | 1296 | ||
1297 | if (BB_isalnum(command[cursor]) || command[cursor] == '_') { | 1297 | if (BB_isalnum(command[cursor]) || command[cursor] == '_') { |
1298 | while (cursor < command_len | 1298 | while (cursor < command_len |
1299 | && (BB_isalnum(command[cursor+1]) || command[cursor+1] == '_')) | 1299 | && (BB_isalnum(command[cursor+1]) || command[cursor+1] == '_') |
1300 | ) { | ||
1300 | input_forward(); | 1301 | input_forward(); |
1302 | } | ||
1301 | } else if (BB_ispunct(command[cursor])) { | 1303 | } else if (BB_ispunct(command[cursor])) { |
1302 | while (cursor < command_len && BB_ispunct(command[cursor+1])) | 1304 | while (cursor < command_len && BB_ispunct(command[cursor+1])) |
1303 | input_forward(); | 1305 | input_forward(); |
@@ -1306,9 +1308,10 @@ vi_word_motion(int eat) | |||
1306 | if (cursor < command_len) | 1308 | if (cursor < command_len) |
1307 | input_forward(); | 1309 | input_forward(); |
1308 | 1310 | ||
1309 | if (eat && cursor < command_len && BB_isspace(command[cursor])) | 1311 | if (eat) { |
1310 | while (cursor < command_len && BB_isspace(command[cursor])) | 1312 | while (cursor < command_len && BB_isspace(command[cursor])) |
1311 | input_forward(); | 1313 | input_forward(); |
1314 | } | ||
1312 | } | 1315 | } |
1313 | 1316 | ||
1314 | static void | 1317 | static void |
@@ -1592,7 +1595,7 @@ static int lineedit_read_key(char *read_key_buffer) | |||
1592 | 1595 | ||
1593 | /* leave out the "vi-mode"-only case labels if vi editing isn't | 1596 | /* leave out the "vi-mode"-only case labels if vi editing isn't |
1594 | * configured. */ | 1597 | * configured. */ |
1595 | #define vi_case(caselabel) IF_FEATURE_EDITING(case caselabel) | 1598 | #define vi_case(caselabel) IF_FEATURE_EDITING_VI(case caselabel) |
1596 | 1599 | ||
1597 | /* convert uppercase ascii to equivalent control char, for readability */ | 1600 | /* convert uppercase ascii to equivalent control char, for readability */ |
1598 | #undef CTRL | 1601 | #undef CTRL |