vi: preserve state when switching file

When a new file is opened from an existing editing session the
following details should be preserved:

- the last command used;
- the last character searched for on a line.

function                                             old     new   delta
edit_file                                            849     835     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-14)             Total: -14 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Ron Yorston 2021-04-25 11:53:54 +01:00 committed by Denys Vlasenko
parent b9aaa375a3
commit e6bc8a29a9

View File

@ -4462,7 +4462,6 @@ static void edit_file(char *fn)
mark[26] = mark[27] = text; // init "previous context"
#endif
last_search_char = '\0';
#if ENABLE_FEATURE_VI_CRASHME
last_input_char = '\0';
#endif
@ -4489,7 +4488,6 @@ static void edit_file(char *fn)
#if ENABLE_FEATURE_VI_DOT_CMD
free(ioq_start);
ioq_start = NULL;
lmc_len = 0;
adding2q = 0;
#endif