aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-04-02 11:50:25 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-04-02 11:50:25 +0200
commitbbacd03ccc48734fb75fdac90e0bdd6c52c22cd1 (patch)
tree6ae3c2bdd742390f521acdd749a9c744b22713cc
parentb29dce4bc293d6800e94569ac7d0df54bd1f8a94 (diff)
downloadbusybox-w32-bbacd03ccc48734fb75fdac90e0bdd6c52c22cd1.tar.gz
busybox-w32-bbacd03ccc48734fb75fdac90e0bdd6c52c22cd1.tar.bz2
busybox-w32-bbacd03ccc48734fb75fdac90e0bdd6c52c22cd1.zip
vi: restore capability to remember insertion cmds for "."
function old new delta modifying_cmds 17 22 +5 get_one_char 103 98 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 5/-5) Total: 0 bytes text data bss dec hex filename 982121 485 7296 989902 f1ace busybox_old 982094 485 7296 989875 f1ab3 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/vi.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 993630d6f..9d0fc23cf 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -244,9 +244,7 @@ enum {
244 244
245#if ENABLE_FEATURE_VI_DOT_CMD || ENABLE_FEATURE_VI_YANKMARK 245#if ENABLE_FEATURE_VI_DOT_CMD || ENABLE_FEATURE_VI_YANKMARK
246// cmds modifying text[] 246// cmds modifying text[]
247// vda: removed "aAiIs" as they switch us into insert mode 247static const char modifying_cmds[] ALIGN1 = "aAcCdDiIJoOpPrRs""xX<>~";
248// and remembering input for replay after them makes no sense
249static const char modifying_cmds[] ALIGN1 = "cCdDJoOpPrRxX<>~";
250#endif 248#endif
251 249
252enum { 250enum {
@@ -1053,8 +1051,11 @@ static int get_one_char(void)
1053 } 1051 }
1054 // we are adding STDIN chars to q. 1052 // we are adding STDIN chars to q.
1055 c = readit(); 1053 c = readit();
1056 if (lmc_len >= MAX_INPUT_LEN - 1) { 1054 if (lmc_len >= ARRAY_SIZE(last_modifying_cmd) - 1) {
1057 status_line_bold("last_modifying_cmd overrun"); 1055 // last_modifying_cmd[] is too small, can't remeber the cmd
1056 // - drop it
1057 adding2q = 0;
1058 lmc_len = 0;
1058 } else { 1059 } else {
1059 last_modifying_cmd[lmc_len++] = c; 1060 last_modifying_cmd[lmc_len++] = c;
1060 } 1061 }