summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-07-28 21:51:37 +0100
committerBram Moolenaar <Bram@vim.org>2022-07-28 21:51:37 +0100
commita6f9e300161f4cb54713da22f65b261595e8e614 (patch)
treef0663fef4a680eeaa7826e6f0cb4143aa51c0c3e /src
parent4e677b9c40ccbc5f090971b31dc2fe07bf05541d (diff)
patch 9.0.0102: reading past end of line with insert mode completionv9.0.0102
Problem: Reading past end of line with insert mode completion. Solution: Check text length.
Diffstat (limited to 'src')
-rw-r--r--src/insexpand.c2
-rw-r--r--src/testdir/test_ins_complete.vim8
-rw-r--r--src/version.c2
3 files changed, 11 insertions, 1 deletions
diff --git a/src/insexpand.c b/src/insexpand.c
index 7339ce9c6e..fc3eff0713 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -3501,7 +3501,7 @@ ins_comp_get_next_word_or_line(
{
char_u *tmp_ptr = ptr;
- if (compl_status_adding())
+ if (compl_status_adding() && compl_length <= (int)STRLEN(tmp_ptr))
{
tmp_ptr += compl_length;
// Skip if already inside a word.
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index 35c5785d3a..2b0a2947a0 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -2142,5 +2142,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
diff --git a/src/version.c b/src/version.c
index 1241e98b08..ce6caa5092 100644
--- a/src/version.c
+++ b/src/version.c
@@ -736,6 +736,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 102,
+/**/
101,
/**/
100,