comparison src/spellsuggest.c @ 29208:b8dc0a76911e v8.2.5123

patch 8.2.5123: using invalid index when looking for spell suggestions Commit: https://github.com/vim/vim/commit/156d3911952d73b03d7420dc3540215247db0fe8 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 18 14:09:08 2022 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 18 Jun 2022 15:15:04 +0200
parents 77cd4bf3ad7d
children 6d93f09815c1
comparison
equal deleted inserted replaced
29207:d0bec8ebee71 29208:b8dc0a76911e
1971 sp->ts_tcharlen = MB_BYTE2LEN(c); 1971 sp->ts_tcharlen = MB_BYTE2LEN(c);
1972 sp->ts_fcharstart = sp->ts_fidx - 1; 1972 sp->ts_fcharstart = sp->ts_fidx - 1;
1973 sp->ts_isdiff = (newscore != 0) 1973 sp->ts_isdiff = (newscore != 0)
1974 ? DIFF_YES : DIFF_NONE; 1974 ? DIFF_YES : DIFF_NONE;
1975 } 1975 }
1976 else if (sp->ts_isdiff == DIFF_INSERT) 1976 else if (sp->ts_isdiff == DIFF_INSERT
1977 && sp->ts_fidx > 0)
1977 // When inserting trail bytes don't advance in the 1978 // When inserting trail bytes don't advance in the
1978 // bad word. 1979 // bad word.
1979 --sp->ts_fidx; 1980 --sp->ts_fidx;
1980 if (++sp->ts_tcharidx == sp->ts_tcharlen) 1981 if (++sp->ts_tcharidx == sp->ts_tcharlen)
1981 { 1982 {