changeset 22645:13904ca59f96 v8.2.1871

patch 8.2.1871: using %v in 'errorformat' may fail before %Z Commit: https://github.com/vim/vim/commit/c95940c06a125d3afe6516f11f8b2f5697a6b3b9 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Oct 20 14:59:12 2020 +0200 patch 8.2.1871: using %v in 'errorformat' may fail before %Z Problem: Using %v in 'errorformat' may fail before %Z. Solution: Set qf_viscol only when qf_col is set. (closes https://github.com/vim/vim/issues/7169)
author Bram Moolenaar <Bram@vim.org>
date Tue, 20 Oct 2020 15:00:04 +0200
parents 1b7f6ac87280
children 672a0baecb03
files src/quickfix.c src/testdir/test_quickfix.vim src/version.c
diffstat 3 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -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,
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -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')
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1871,
+/**/
     1870,
 /**/
     1869,