aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-24 21:46:06 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-08-25 06:53:59 +0800
commitdd77a0062108d6ecfc00bbc50b0d6d738df0b89d (patch)
treef18f68e8323ffa68148ccd160071fc853cfc45c4 /src
parent6680002169a8cc505186e81acc161bec40658d73 (diff)
downloadrneovim-dd77a0062108d6ecfc00bbc50b0d6d738df0b89d.tar.gz
rneovim-dd77a0062108d6ecfc00bbc50b0d6d738df0b89d.tar.bz2
rneovim-dd77a0062108d6ecfc00bbc50b0d6d738df0b89d.zip
vim-patch:9.0.0102: reading past end of line with insert mode completion
Problem: Reading past end of line with insert mode completion. Solution: Check text length. https://github.com/vim/vim/commit/a6f9e300161f4cb54713da22f65b261595e8e614
Diffstat (limited to 'src')
-rw-r--r--src/nvim/insexpand.c2
-rw-r--r--src/nvim/testdir/test_ins_complete.vim8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index 56f8834b56..d22c1ff980 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -2813,7 +2813,7 @@ static char_u *ins_comp_get_next_word_or_line(buf_T *ins_buf, pos_T *cur_match_p
} else {
char_u *tmp_ptr = ptr;
- if (compl_cont_status & CONT_ADDING) {
+ if (compl_cont_status & CONT_ADDING && compl_length <= (int)STRLEN(tmp_ptr)) {
tmp_ptr += compl_length;
// Skip if already inside a word.
if (vim_iswordp(tmp_ptr)) {
diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim
index 9aa3881724..8f7d2cb278 100644
--- a/src/nvim/testdir/test_ins_complete.vim
+++ b/src/nvim/testdir/test_ins_complete.vim
@@ -986,5 +986,13 @@ func Test_ins_complete_add()
bwipe!
endfunc
+func Test_ins_complete_end_of_line()
+ " this was reading past the end of the line
+ new
+ norm 8o€ý 
+ sil! norm o
+
+ bwipe!
+endfunc
" vim: shiftwidth=2 sts=2 expandtab