diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-12-19 22:25:40 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-12-19 22:25:40 +0100 |
commit | 1bd999f982e783219a06e6c8f219df1d53ac7e77 (patch) | |
tree | 28068b42e03ad713bfa8ed033ffc8d80c026a4b8 | |
parent | 8ada6aa9298b4764d9ca0024dd21b17e815595ce (diff) | |
download | vim-git-1bd999f982e783219a06e6c8f219df1d53ac7e77.tar.gz |
patch 8.0.1417: test doesn't search for a sentencev8.0.1417
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().
-rw-r--r-- | src/misc2.c | 23 | ||||
-rw-r--r-- | src/testdir/test_search.vim | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 25 insertions, 4 deletions
diff --git a/src/misc2.c b/src/misc2.c index fd432cdba..460ea7489 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -417,8 +417,21 @@ dec(pos_T *lp) #ifdef FEAT_VIRTUALEDIT lp->coladd = 0; #endif - if (lp->col > 0) /* still within line */ + if (lp->col == MAXCOL) { + /* past end of line */ + p = ml_get(lp->lnum); + lp->col = (colnr_T)STRLEN(p); +#ifdef FEAT_MBYTE + if (has_mbyte) + lp->col -= (*mb_head_off)(p, p + lp->col); +#endif + return 0; + } + + if (lp->col > 0) + { + /* still within line */ lp->col--; #ifdef FEAT_MBYTE if (has_mbyte) @@ -429,8 +442,10 @@ dec(pos_T *lp) #endif return 0; } - if (lp->lnum > 1) /* there is a prior line */ + + if (lp->lnum > 1) { + /* there is a prior line */ lp->lnum--; p = ml_get(lp->lnum); lp->col = (colnr_T)STRLEN(p); @@ -440,7 +455,9 @@ dec(pos_T *lp) #endif return 1; } - return -1; /* at start of file */ + + /* at start of file */ + return -1; } /* diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim index 84edfbbd4..9b96b49fd 100644 --- a/src/testdir/test_search.vim +++ b/src/testdir/test_search.vim @@ -733,6 +733,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 diff --git a/src/version.c b/src/version.c index 11ff6038e..2ab6aac0f 100644 --- a/src/version.c +++ b/src/version.c @@ -772,6 +772,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1417, +/**/ 1416, /**/ 1415, |