mirror of
https://github.com/vim/vim.git
synced 2025-10-19 08:04:27 -04:00
patch 8.2.5123: using invalid index when looking for spell suggestions
Problem: Using invalid index when looking for spell suggestions. Solution: Do not decrement the index when it is zero.
This commit is contained in:
@@ -1973,7 +1973,8 @@ suggest_trie_walk(
|
|||||||
sp->ts_isdiff = (newscore != 0)
|
sp->ts_isdiff = (newscore != 0)
|
||||||
? DIFF_YES : DIFF_NONE;
|
? DIFF_YES : DIFF_NONE;
|
||||||
}
|
}
|
||||||
else if (sp->ts_isdiff == DIFF_INSERT)
|
else if (sp->ts_isdiff == DIFF_INSERT
|
||||||
|
&& sp->ts_fidx > 0)
|
||||||
// When inserting trail bytes don't advance in the
|
// When inserting trail bytes don't advance in the
|
||||||
// bad word.
|
// bad word.
|
||||||
--sp->ts_fidx;
|
--sp->ts_fidx;
|
||||||
|
@@ -70,6 +70,16 @@ func Test_z_equal_on_invalid_utf8_word()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_z_equal_on_single_character()
|
||||||
|
" this was decrementing the index below zero
|
||||||
|
new
|
||||||
|
norm a0\<5C>
|
||||||
|
norm zW
|
||||||
|
norm z=
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Test spellbadword() with argument
|
" Test spellbadword() with argument
|
||||||
func Test_spellbadword()
|
func Test_spellbadword()
|
||||||
set spell
|
set spell
|
||||||
|
@@ -734,6 +734,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
5123,
|
||||||
/**/
|
/**/
|
||||||
5122,
|
5122,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user