Vimtex: Compiler vlty: improve error localisation on text lines with multi-byte characters

Created on 16 Oct 2020  路  8Comments  路  Source: lervag/vimtex

(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?

bug

All 8 comments

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.

The Vim issue is fixed, see the PR. Don't know, how fast the patch will "trickle down" to the user. Maybe, this idea is feasible.

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! :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lervag picture lervag  路  3Comments

vanabel picture vanabel  路  6Comments

siemdejong picture siemdejong  路  5Comments

adimanea picture adimanea  路  5Comments

carloabelli picture carloabelli  路  3Comments