Mercurial > vim
changeset 29521:f538704ca03b v9.0.0102
patch 9.0.0102: reading past end of line with insert mode completion
Commit: https://github.com/vim/vim/commit/a6f9e300161f4cb54713da22f65b261595e8e614
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 28 21:51:37 2022 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 28 Jul 2022 23:00:04 +0200 |
parents | bdf63b777f16 |
children | 1deb9ffc5948 |
files | src/insexpand.c src/testdir/test_ins_complete.vim src/version.c |
diffstat | 3 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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.
--- 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