]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.1678: errorformat "%r" implies "%>" v8.0.1678
authorBram Moolenaar <Bram@vim.org>
Sun, 8 Apr 2018 11:27:39 +0000 (13:27 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 8 Apr 2018 11:27:39 +0000 (13:27 +0200)
Problem:    Errorformat "%r" implies "%>". (Jan Gosmann)
Solution:   Jump to before setting fmt_ptr. (Yegappan Lakshmanan,
            closes #2785)

src/quickfix.c
src/testdir/test_quickfix.vim
src/version.c

index e5bd2d0f005f52fab7e7ab109acf6940d91e6a75..8c1df17938d321d13150b7626f1f2d935e2804ae 100644 (file)
@@ -844,6 +844,7 @@ qf_parse_line(
     /* Always ignore case when looking for a matching error. */
     regmatch.rm_ic = TRUE;
 
+restofline:
     /* If there was no %> item start at the first pattern */
     if (fmt_start == NULL)
        fmt_ptr = fmt_first;
@@ -858,7 +859,6 @@ qf_parse_line(
      * match or no match.
      */
     fields->valid = TRUE;
-restofline:
     for ( ; fmt_ptr != NULL; fmt_ptr = fmt_ptr->next)
     {
        int r;
index 070582dfbe964461b43b965e14d48e6d6c167f9e..b0e14e6ad026c1d3075adcc4ebb8bd6baea7e068 100644 (file)
@@ -2582,6 +2582,29 @@ func Xmultifilestack_tests(cchar)
   call assert_equal(3, l1.items[1].lnum)
   call assert_equal('two.txt', bufname(l2.items[1].bufnr))
   call assert_equal(5, l2.items[1].lnum)
+
+  " Test for start of a new error line in the same line where a previous
+  " error line ends with a file stack.
+  let efm_val = 'Error\ l%l\ in\ %f,'
+  let efm_val .= '%-P%>(%f%r,Error\ l%l\ in\ %m,%-Q)%r'
+  let l = g:Xgetlist({'lines' : [
+             \ '(one.txt',
+             \ 'Error l4 in one.txt',
+             \ ') (two.txt',
+             \ 'Error l6 in two.txt',
+             \ ')',
+             \ 'Error l8 in one.txt'
+             \ ], 'efm' : efm_val})
+  call assert_equal(3, len(l.items))
+  call assert_equal('one.txt', bufname(l.items[0].bufnr))
+  call assert_equal(4, l.items[0].lnum)
+  call assert_equal('one.txt', l.items[0].text)
+  call assert_equal('two.txt', bufname(l.items[1].bufnr))
+  call assert_equal(6, l.items[1].lnum)
+  call assert_equal('two.txt', l.items[1].text)
+  call assert_equal('one.txt', bufname(l.items[2].bufnr))
+  call assert_equal(8, l.items[2].lnum)
+  call assert_equal('', l.items[2].text)
 endfunc
 
 func Test_multifilestack()
index 1b2a1fa0f047cdec17ff38fbae1fc2866e084808..c7e47f51b278a8ebf7cf5c531f98ddcd985876b0 100644 (file)
@@ -762,6 +762,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1678,
 /**/
     1677,
 /**/