Describe the bug
In single-line messages parsed with errorformat, code %v correctly treats column numbers, if multi-byte characters occur in front of the indicated error on the current line.
In multi-line messages, this does not always work.
To Reproduce
In the following, a working and a not working example are given. Assume the text file t.txt (UTF-8) with the leading multi-byte character ä:
ä test
We have two compilers, both reporting a problem starting at column 3. This is m1.sh:
#!/bin/bash
echo "=== t.txt ==="
echo "1:3:an error"
Compiler m2.sh returns the error message text on a third line:
#!/bin/bash
echo "=== t.txt ==="
echo "1:3"
echo "an error"
If one now says, for the first compiler,
:set errorformat=%I===\ %f\ ===,%Z%l:%v:%m
:set makeprg=./m1.sh
then after :make the quickfix window (:cw) is
t.txt|1 col 3 info| an error
After hitting Enter in the quickfix window, the cursor is correctly placed at the beginning of test (screen column 3).
For the second compiler, we say
:set errorformat=%I===\ %f\ ===,%C%l:%v,%Z%m
:set makeprg=./m2.sh
The quickfix window shows exactly the same message as in the first case, but on Enter, the cursor goes to the second screen column, i.e., to the space between ä and test.
Expected behavior
If errorformat is correct (which I'm not absolutely sure about), the second example should place the cursor in screen column 3, too.
Environment (please complete the following information):
Additional context
File quickfix.c contains in function qf_parse_multiline_pfx() the line 1366
qfprev->qf_viscol = fields->use_viscol;
If one replaces it (similarly to the adjacent statements) with
if (!qfprev->qf_viscol)
qfprev->qf_viscol = fields->use_viscol;
then the reported problem vanishes. But this is not more than a guess, so I cannot provide a PR.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
you could create a PR and we would see if any tests fail.
The PR is #7169, quote from there:
Although all tests on Travis CI passed, I have a bad feeling with this PR. The change is more an "educated guess", as I do not really understand the machinery at work. There seem to be no tests for %v with multi-line massages in test_quickfix.c.
The PR is #7169, quote from there:
Although all tests on Travis CI passed, I have a bad feeling with this PR. The change is more an "educated guess", as I do not really understand the machinery at work. There seem to be no tests for %v with multi-line massages in test_quickfix.c.
The PR has been merged.
—
You are receiving this because you commented.