Prior to c45eb77, the %v symbol for errorformat did what it says in the help page:
virtual column number (finds a number representing screen column of the error (1 tab == 8 screen columns))
The usecase is that if a file is indented using tabs and the compiler reports column numbers by virtually expanding tabs to 8 characters, then vim with %v would revert this expansion back to real column positions by counting back for each tab character up to the reported column position. This is opposed to %c, where the column number reported by the compiler is taken literally.
The above commit regressed this behaviour, as it now simply calls into coladvance(), which does not do the same thing, as it skips the operation for Tab characters.
This means that %v in errorformat is broken if the line starts with Tab characters, so the quickfix list obtained with errorformat from compiler output will jump to the wrong column number, which can be observed in this demo for example.
Orthogonal but related to this regression, the gcc errorformat should use %v instead of %c. This is because gcc expands tabs to 8 spaces for quite some time now in its errors, unless -fdiagnostics-column-unit=byte is passed.
This affects at least the following rules in the gcc compiler runtime file:
diff --git a/runtime/compiler/gcc.vim b/runtime/compiler/gcc.vim index 1d5900eb27..e7c7e42663 100644 --- a/runtime/compiler/gcc.vim +++ b/runtime/compiler/gcc.vim @@ -24,9 +24,9 @@ CompilerSet errorformat \\"%f\"%*\\D%l:\ %m, \%-G%f:%l:\ %trror:\ (Each\ undeclared\ identifier\ is\ reported\ only\ once, \%-G%f:%l:\ %trror:\ for\ each\ function\ it\ appears\ in.), - \%f:%l:%c:\ %trror:\ %m, - \%f:%l:%c:\ %tarning:\ %m, - \%f:%l:%c:\ %m, + \%f:%l:%v:\ %trror:\ %m, + \%f:%l:%v:\ %tarning:\ %m, + \%f:%l:%v:\ %m, \%f:%l:\ %trror:\ %m, \%f:%l:\ %tarning:\ %m, \%f:%l:\ %m,
Here is a minimal reproducible example:
int main(int argc, char *argv[]) { foo(); return 0; }
The file is indented using tabs, so gcc will report the error in main.c:3:9, but if %v is used, vim needs to translate the 9 back to 2, which it no longer doesn't since #3700.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()