From ae828982ceb9dc4c5bde58a276e6e10df6f35051 Mon Sep 17 00:00:00 2001 From: raichoo Date: Sat, 11 Mar 2017 10:46:50 +0100 Subject: vim-patch:7.4.2347 Problem: Crash when closing a buffer while Visual mode is active. (Dominique Pelle) Solution: Adjust the position before computing the number of lines. When closing the current buffer stop Visual mode. https://github.com/vim/vim/commit/c4a908e83690844b0d3a46124ba6af7d23485d69 --- src/nvim/buffer.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/nvim/buffer.c') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index f52989c74d..0a95cc9020 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -438,6 +438,13 @@ 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) { + end_visual_mode(); + } + buf->b_nwindows = nwindows; buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0)); @@ -1075,6 +1082,11 @@ do_buffer ( } } + // When closing the current buffer stop Visual mode. + if (buf == curbuf) { + end_visual_mode(); + } + /* * If deleting the last (listed) buffer, make it empty. * The last (listed) buffer cannot be unloaded. -- cgit From 86b1e7f5834d58eebc87735c9a531040fea1a0f7 Mon Sep 17 00:00:00 2001 From: raichoo Date: Sat, 11 Mar 2017 13:42:06 +0100 Subject: vim-patch:7.4.2362 Problem: Illegal memory access with ":1@". (Dominique Pelle) Solution: Correct cursor column after setting the line number. Also avoid calling end_visual_mode() when not in Visual mode. https://github.com/vim/vim/commit/4930a76a0357f76a829eafe4985d04cf3ce0e9e0 --- src/nvim/buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/buffer.c') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 0a95cc9020..f97f05e697 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -441,7 +441,7 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last) // When closing the current buffer stop Visual mode before freeing // anything. - if (is_curbuf) { + if (is_curbuf && VIsual_active) { end_visual_mode(); } @@ -1083,7 +1083,7 @@ do_buffer ( } // When closing the current buffer stop Visual mode. - if (buf == curbuf) { + if (buf == curbuf && VIsual_active) { end_visual_mode(); } -- cgit From 99f2dc1341c8501290e3a0b297e1700f74fd17a3 Mon Sep 17 00:00:00 2001 From: raichoo Date: Sat, 11 Mar 2017 16:43:15 +0100 Subject: vim-patch:8.0.0229 Problem: When freeing a buffer the local value of the 'formatprg' option is not cleared. Solution: Add missing change. https://github.com/vim/vim/commit/24a2d416ec261829ff7fd29f7b66739c96dd6513 --- src/nvim/buffer.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/buffer.c') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index f97f05e697..ab45008962 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1679,6 +1679,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); -- cgit From db128974fcbd5702ca724610590a5dafa2e87712 Mon Sep 17 00:00:00 2001 From: raichoo Date: Thu, 16 Mar 2017 07:40:31 +0100 Subject: vim-patch:7.4.2348 Problem: Crash on exit when EXITFREE is defined. (Dominique Pelle) Solution: Don't access curwin when exiting. https://github.com/vim/vim/commit/9a27c7fde6d453d9892b6f6baa756bce4d6d419d --- src/nvim/buffer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/nvim/buffer.c') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index ab45008962..9e781f5dff 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -441,7 +441,11 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last) // When closing the current buffer stop Visual mode before freeing // anything. - if (is_curbuf && VIsual_active) { + if (is_curbuf && VIsual_active +#if defined(EXITFREE) + && !entered_free_all_mem +#endif + ) { end_visual_mode(); } -- cgit