vim-patch:8.0.1417: test doesn't search for a sentence

Problem:    Test doesn't search for a sentence. Still fails when searching for
            start of sentence. (Dominique Pelle)
Solution:   Add paren. Check for MAXCOL in dec().
1bd999f982
This commit is contained in:
Jan Edmund Lazo 2018-09-16 20:46:28 -04:00
parent 91352b36b7
commit 0b60372792
2 changed files with 18 additions and 4 deletions

View File

@ -4032,20 +4032,32 @@ int incl(pos_T *lp)
int dec(pos_T *lp)
{
lp->coladd = 0;
if (lp->col > 0) { // still within line
if (lp->col == MAXCOL) {
// past end of line
char_u *p = ml_get(lp->lnum);
lp->col = (colnr_T)STRLEN(p);
lp->col -= utf_head_off(p, p + lp->col);
return 0;
}
if (lp->col > 0) {
// still within line
lp->col--;
char_u *p = ml_get(lp->lnum);
lp->col -= utf_head_off(p, p + lp->col);
return 0;
}
if (lp->lnum > 1) { // there is a prior line
if (lp->lnum > 1) {
// there is a prior line
lp->lnum--;
char_u *p = ml_get(lp->lnum);
lp->col = (colnr_T)STRLEN(p);
lp->col -= utf_head_off(p, p + lp->col);
return 1;
}
return -1; // at start of file
// at start of file
return -1;
}
/// Same as dec(), but skip NUL at the end of non-empty lines.

View File

@ -484,6 +484,8 @@ endfunc
func Test_search_sentence()
new
" this used to cause a crash
call assert_fails("/\\%'", 'E486')
call assert_fails("/\\%')", 'E486')
call assert_fails("/", 'E486')
/\%'(
/
endfunc