mirror of
https://github.com/sheumann/hush.git
synced 2024-11-05 06:07:00 +00:00
vi: small code shrink
function old new delta vi_word_motion 185 165 -20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
fda8f57360
commit
1302892a14
@ -1296,8 +1296,10 @@ vi_word_motion(int eat)
|
|||||||
|
|
||||||
if (BB_isalnum(command[cursor]) || command[cursor] == '_') {
|
if (BB_isalnum(command[cursor]) || command[cursor] == '_') {
|
||||||
while (cursor < command_len
|
while (cursor < command_len
|
||||||
&& (BB_isalnum(command[cursor+1]) || command[cursor+1] == '_'))
|
&& (BB_isalnum(command[cursor+1]) || command[cursor+1] == '_')
|
||||||
|
) {
|
||||||
input_forward();
|
input_forward();
|
||||||
|
}
|
||||||
} else if (BB_ispunct(command[cursor])) {
|
} else if (BB_ispunct(command[cursor])) {
|
||||||
while (cursor < command_len && BB_ispunct(command[cursor+1]))
|
while (cursor < command_len && BB_ispunct(command[cursor+1]))
|
||||||
input_forward();
|
input_forward();
|
||||||
@ -1306,10 +1308,11 @@ vi_word_motion(int eat)
|
|||||||
if (cursor < command_len)
|
if (cursor < command_len)
|
||||||
input_forward();
|
input_forward();
|
||||||
|
|
||||||
if (eat && cursor < command_len && BB_isspace(command[cursor]))
|
if (eat) {
|
||||||
while (cursor < command_len && BB_isspace(command[cursor]))
|
while (cursor < command_len && BB_isspace(command[cursor]))
|
||||||
input_forward();
|
input_forward();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vi_End_motion(void)
|
vi_End_motion(void)
|
||||||
@ -1592,7 +1595,7 @@ static int lineedit_read_key(char *read_key_buffer)
|
|||||||
|
|
||||||
/* leave out the "vi-mode"-only case labels if vi editing isn't
|
/* leave out the "vi-mode"-only case labels if vi editing isn't
|
||||||
* configured. */
|
* configured. */
|
||||||
#define vi_case(caselabel) IF_FEATURE_EDITING(case caselabel)
|
#define vi_case(caselabel) IF_FEATURE_EDITING_VI(case caselabel)
|
||||||
|
|
||||||
/* convert uppercase ascii to equivalent control char, for readability */
|
/* convert uppercase ascii to equivalent control char, for readability */
|
||||||
#undef CTRL
|
#undef CTRL
|
||||||
|
Loading…
Reference in New Issue
Block a user