(This is more a request for help, possibly it should be placed elsewhere.)
Vimtex receives the error messages from compiler vlty via multi-line messages that are parsed using errorformat. According to the Vim repository, a specification %v in errorformat should expand tabs and handle multi-byte characters. Unfortunately, the latter apparently does not work correctly for multi-line messages from the compiler.
Assume the text file t.txt (UTF-8) with the leading multi-byte 盲:
盲 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 messages 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 is the same, but on Enter, the cursor goes to the second screen column, i.e., to the space between 盲 and test.
Is the second errorformat correct?
This seems to be a Vim bug, see the Vim issue. Sorry for the noise.
Thanks for looking into it and providing all the information. I think you're right that this is a Vim issue and not a vimtex issue, so I'll close it.
Great work! I'm curious, would you also be willing to port the patch to neovim?
Maybe, this idea is feasible.
I think it sounds like a good idea. Still, I also think this issue is relatively minor, and the vlty compiler is still useful as it is now.
Great work!
Thanks :) Well, I made an initial "guess" fix that worked, and then all was a quite nice experience: they proposed the correct solution and provided an example to write the corresponding tests.
I'm curious, would you also be willing to port the patch to neovim?
Before raising the issue, I also tried neovim. My impression from the repo was that somebody is following the Vim patches. Will have a look again. If they do not incorporate the patch "automatically", I will make a PR. At least the both affected files do exist there, too.
EDIT. Oh, just see that janlazo/neovim made a reference to the commit.
I think it sounds like a good idea. Still, I also think this issue is relatively minor, and the vlty compiler is still useful as it is now.
Yes, this is my opinion, too. It can be done if a user is really complaining about the localisation.
EDIT. Oh, just see that janlazo/neovim made a reference to the commit.
Yes, and the PR is here: https://github.com/neovim/neovim/pull/13123
I like this community! :)