diff options
-rw-r--r-- | editors/vi.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/editors/vi.c b/editors/vi.c index 1e39b52ff..f33db66c6 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -715,14 +715,6 @@ static int init_text_buffer(char *fn) { int rc; - flush_undo_data(); - modified_count = 0; - last_modified_count = -1; -#if ENABLE_FEATURE_VI_YANKMARK - /* init the marks */ - memset(mark, 0, sizeof(mark)); -#endif - /* allocate/reallocate text buffer */ free(text); text_size = 10240; @@ -737,6 +729,14 @@ static int init_text_buffer(char *fn) // file doesnt exist. Start empty buf with dummy line char_insert(text, '\n', NO_UNDO); } + + flush_undo_data(); + modified_count = 0; + last_modified_count = -1; +#if ENABLE_FEATURE_VI_YANKMARK + /* init the marks */ + memset(mark, 0, sizeof(mark)); +#endif return rc; } |