diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-03-20 00:47:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-20 00:47:27 +0100 |
commit | 091a99afd43126d5e25fd6ea3f19f531a1b5cb9c (patch) | |
tree | b9cebfa51815137e8c26b9d3581106e551aba81d /src/nvim/buffer.c | |
parent | 0cab62ad6fc642c06e4249dccac092dd71b0cb3e (diff) | |
parent | 2f54d6927cc02484b528a5e8b25b64c8d6580ddd (diff) | |
download | rneovim-091a99afd43126d5e25fd6ea3f19f531a1b5cb9c.tar.gz rneovim-091a99afd43126d5e25fd6ea3f19f531a1b5cb9c.tar.bz2 rneovim-091a99afd43126d5e25fd6ea3f19f531a1b5cb9c.zip |
Merge #6318 from justinmk/pr6244
test/legacy: fix test_normal.vim
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index f52989c74d..9e781f5dff 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -438,6 +438,17 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last) /* Remember if we are closing the current buffer. Restore the number of * windows, so that autocommands in buf_freeall() don't get confused. */ bool is_curbuf = (buf == curbuf); + + // When closing the current buffer stop Visual mode before freeing + // anything. + if (is_curbuf && VIsual_active +#if defined(EXITFREE) + && !entered_free_all_mem +#endif + ) { + end_visual_mode(); + } + buf->b_nwindows = nwindows; buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0)); @@ -1075,6 +1086,11 @@ do_buffer ( } } + // When closing the current buffer stop Visual mode. + if (buf == curbuf && VIsual_active) { + end_visual_mode(); + } + /* * If deleting the last (listed) buffer, make it empty. * The last (listed) buffer cannot be unloaded. @@ -1667,6 +1683,7 @@ void free_buf_options(buf_T *buf, int free_p_ff) clear_string_option(&buf->b_p_inex); clear_string_option(&buf->b_p_inde); clear_string_option(&buf->b_p_indk); + clear_string_option(&buf->b_p_fp); clear_string_option(&buf->b_p_fex); clear_string_option(&buf->b_p_kp); clear_string_option(&buf->b_p_mps); |