aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-06-22 07:55:01 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-06-23 18:17:09 -0400
commit1935cc263993a9c0cb1bae510347a7c344b5b37c (patch)
treee701a9e79db5eda6bd5d1f6142d6095632fdc796
parent3a49fa8f8b348b48e90860ec3fdf005d301ba9d0 (diff)
downloadrneovim-1935cc263993a9c0cb1bae510347a7c344b5b37c.tar.gz
rneovim-1935cc263993a9c0cb1bae510347a7c344b5b37c.tar.bz2
rneovim-1935cc263993a9c0cb1bae510347a7c344b5b37c.zip
vim-patch:8.1.0242: Insert mode completion may use an invalid buffer pointer
Problem: Insert mode completion may use an invalid buffer pointer. Solution: Check for ins_buf to be valid. (closes vim/vim#3290) https://github.com/vim/vim/commit/02ab97709d5c56fb7fe42e134bb9fc54f76a1f9f
-rw-r--r--src/nvim/edit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 9af003f140..8040109685 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -3838,11 +3838,14 @@ static int ins_compl_get_exp(pos_T *ini)
e_cpt = (compl_cont_status & CONT_LOCAL)
? (char_u *)"." : curbuf->b_p_cpt;
last_match_pos = first_match_pos = *ini;
+ } else if (ins_buf != curbuf && !buf_valid(ins_buf)) {
+ ins_buf = curbuf; // In case the buffer was wiped out.
}
compl_old_match = compl_curr_match; // remember the last current match
pos = (compl_direction == FORWARD) ? &last_match_pos : &first_match_pos;
- /* For ^N/^P loop over all the flags/windows/buffers in 'complete' */
+
+ // For ^N/^P loop over all the flags/windows/buffers in 'complete'
for (;; ) {
found_new_match = FAIL;
set_match_pos = FALSE;