]> granicus.if.org Git - vim/commitdiff
patch 8.2.1871: using %v in 'errorformat' may fail before %Z v8.2.1871
authorBram Moolenaar <Bram@vim.org>
Tue, 20 Oct 2020 12:59:12 +0000 (14:59 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 20 Oct 2020 12:59:12 +0000 (14:59 +0200)
Problem:    Using %v in 'errorformat' may fail before %Z.
Solution:   Set qf_viscol only when qf_col is set. (closes #7169)

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

index d50cd16a1f1b626310e98770d46112d7128d978c..5e0d3c35247df0022ab43deabb948684d76bc6d0 100644 (file)
@@ -1362,8 +1362,10 @@ qf_parse_multiline_pfx(
        if (!qfprev->qf_lnum)
            qfprev->qf_lnum = fields->lnum;
        if (!qfprev->qf_col)
+       {
            qfprev->qf_col = fields->col;
-       qfprev->qf_viscol = fields->use_viscol;
+           qfprev->qf_viscol = fields->use_viscol;
+       }
        if (!qfprev->qf_fnum)
            qfprev->qf_fnum = qf_get_fnum(qfl,
                    qfl->qf_directory,
index 332831aa4add308c8a298d45a0e57f89c2a36e91..88eabaa04ecac63c0f7ea110a5b1b9e064c53157 100644 (file)
@@ -4419,6 +4419,21 @@ func Test_viscol()
   cnext
   call assert_equal([16, 25], [col('.'), virtcol('.')])
 
+  " Use screen column number with a multi-line error message
+  enew
+  call writefile(["à test"], 'Xfile1')
+  set efm=%E===\ %f\ ===,%C%l:%v,%Z%m
+  cexpr ["=== Xfile1 ===", "1:3", "errormsg"]
+  call assert_equal('Xfile1', @%)
+  call assert_equal([0, 1, 4, 0], getpos('.'))
+
+  " Repeat previous test with byte offset %c: ensure that fix to issue #7145
+  " does not break this
+  set efm=%E===\ %f\ ===,%C%l:%c,%Z%m
+  cexpr ["=== Xfile1 ===", "1:3", "errormsg"]
+  call assert_equal('Xfile1', @%)
+  call assert_equal([0, 1, 3, 0], getpos('.'))
+
   enew | only
   set efm&
   call delete('Xfile1')
index 835de6c5bf0ea54c6591afba6879beae094c6759..48f7273e1355e16a1b5e9055d8788536201ede88 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1871,
 /**/
     1870,
 /**/