mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
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.
a6f9e30016
This commit is contained in:
@@ -2813,7 +2813,7 @@ static char_u *ins_comp_get_next_word_or_line(buf_T *ins_buf, pos_T *cur_match_p
|
|||||||
} else {
|
} else {
|
||||||
char_u *tmp_ptr = ptr;
|
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;
|
tmp_ptr += compl_length;
|
||||||
// Skip if already inside a word.
|
// Skip if already inside a word.
|
||||||
if (vim_iswordp(tmp_ptr)) {
|
if (vim_iswordp(tmp_ptr)) {
|
||||||
|
@@ -986,5 +986,13 @@ func Test_ins_complete_add()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
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
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Reference in New Issue
Block a user