diff options
author | Ron Yorston <rmy@pobox.com> | 2021-03-28 13:22:11 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-03-29 12:16:21 +0200 |
commit | d3b74826c5a0843e9c0ef324944d6e084ae15b46 (patch) | |
tree | a32b9dfa0711d5a4bed1868ed2e9fae067afcd08 /editors/vi.c | |
parent | 1e84daf054113b97dad2d1201b8ec7fbebc9aeb3 (diff) | |
download | busybox-w32-d3b74826c5a0843e9c0ef324944d6e084ae15b46.tar.gz busybox-w32-d3b74826c5a0843e9c0ef324944d6e084ae15b46.tar.bz2 busybox-w32-d3b74826c5a0843e9c0ef324944d6e084ae15b46.zip |
vi: allow repetition count for paragraph motion
The paragraph motion commands '{' and '}' should accept a count.
function old new delta
do_cmd 5054 5071 +17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 17/0) Total: 17 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors/vi.c')
-rw-r--r-- | editors/vi.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/editors/vi.c b/editors/vi.c index 4e1a2390f..e3e0f4b44 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -3513,16 +3513,15 @@ static void do_cmd(int c) | |||
3513 | } while (--cmdcnt > 0); | 3513 | } while (--cmdcnt > 0); |
3514 | break; | 3514 | break; |
3515 | case '{': // {- move backward paragraph | 3515 | case '{': // {- move backward paragraph |
3516 | q = char_search(dot, "\n\n", ((unsigned)BACK << 1) | FULL); | ||
3517 | if (q != NULL) { // found blank line | ||
3518 | dot = next_line(q); // move to next blank line | ||
3519 | } | ||
3520 | break; | ||
3521 | case '}': // }- move forward paragraph | 3516 | case '}': // }- move forward paragraph |
3522 | q = char_search(dot, "\n\n", (FORWARD << 1) | FULL); | 3517 | do { |
3523 | if (q != NULL) { // found blank line | 3518 | q = char_search(dot, "\n\n", c == '{' ? |
3524 | dot = next_line(q); // move to next blank line | 3519 | ((unsigned)BACK << 1) | FULL : |
3525 | } | 3520 | (FORWARD << 1) | FULL); |
3521 | if (q != NULL) { // found blank line | ||
3522 | dot = next_line(q); // move to next blank line | ||
3523 | } | ||
3524 | } while (--cmdcnt > 0); | ||
3526 | break; | 3525 | break; |
3527 | #endif /* FEATURE_VI_SEARCH */ | 3526 | #endif /* FEATURE_VI_SEARCH */ |
3528 | case '0': // 0- goto beginning of line | 3527 | case '0': // 0- goto beginning of line |