1 From 8f3bf4f0d3605b50a8e4c48c89aeabc455f04884 Mon Sep 17 00:00:00 2001
2 From: Yousong Zhou <yszhou4tech@gmail.com>
3 Date: Fri, 24 Mar 2017 21:13:10 +0100
4 Subject: [PATCH 2/2] vi: avoid touching a new file with ZZ when no editing has
7 This is the behaviour observed with standard vim and busybox vi of at
8 least 1.22.1. It was changed with commit "32afd3a vi: some
9 simplifications" which happened before 1.23.0.
11 Mistyping filename on command line happens fairly often and it's better
12 we restore the old behaviour to avoid a few unnecessary flash writes and
13 sometimes efforts of debugging bugs caused by those unneeded stray
16 Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
17 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
19 editors/vi.c | 16 ++++++++--------
20 1 file changed, 8 insertions(+), 8 deletions(-)
24 @@ -719,14 +719,6 @@ static int init_text_buffer(char *fn)
30 - last_modified_count = -1;
31 -#if ENABLE_FEATURE_VI_YANKMARK
32 - /* init the marks */
33 - memset(mark, 0, sizeof(mark));
36 /* allocate/reallocate text buffer */
39 @@ -741,6 +733,14 @@ static int init_text_buffer(char *fn)
40 // file doesnt exist. Start empty buf with dummy line
41 char_insert(text, '\n', NO_UNDO);
46 + last_modified_count = -1;
47 +#if ENABLE_FEATURE_VI_YANKMARK
48 + /* init the marks */
49 + memset(mark, 0, sizeof(mark));