Skip to content

Commit 1bd999f

Browse files
committed
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().
1 parent 8ada6aa commit 1bd999f

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

src/misc2.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,21 @@ dec(pos_T *lp)
417417
#ifdef FEAT_VIRTUALEDIT
418418
lp->coladd = 0;
419419
#endif
420-
if (lp->col > 0) /* still within line */
420+
if (lp->col == MAXCOL)
421421
{
422+
/* past end of line */
423+
p = ml_get(lp->lnum);
424+
lp->col = (colnr_T)STRLEN(p);
425+
#ifdef FEAT_MBYTE
426+
if (has_mbyte)
427+
lp->col -= (*mb_head_off)(p, p + lp->col);
428+
#endif
429+
return 0;
430+
}
431+
432+
if (lp->col > 0)
433+
{
434+
/* still within line */
422435
lp->col--;
423436
#ifdef FEAT_MBYTE
424437
if (has_mbyte)
@@ -429,8 +442,10 @@ dec(pos_T *lp)
429442
#endif
430443
return 0;
431444
}
432-
if (lp->lnum > 1) /* there is a prior line */
445+
446+
if (lp->lnum > 1)
433447
{
448+
/* there is a prior line */
434449
lp->lnum--;
435450
p = ml_get(lp->lnum);
436451
lp->col = (colnr_T)STRLEN(p);
@@ -440,7 +455,9 @@ dec(pos_T *lp)
440455
#endif
441456
return 1;
442457
}
443-
return -1; /* at start of file */
458+
459+
/* at start of file */
460+
return -1;
444461
}
445462

446463
/*

src/testdir/test_search.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,8 @@ endfunc
733733
func Test_search_sentence()
734734
new
735735
" this used to cause a crash
736-
call assert_fails("/\\%'", 'E486')
736+
call assert_fails("/\\%')", 'E486')
737737
call assert_fails("/", 'E486')
738+
/\%'(
739+
/
738740
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,8 @@ static char *(features[]) =
771771

772772
static int included_patches[] =
773773
{ /* Add new patch number below this line */
774+
/**/
775+
1417,
774776
/**/
775777
1416,
776778
/**/

0 commit comments

Comments
 (0)