On 4 July 2014, Павлов Николай Александрович
<[email protected]> wrote:
> On July 1, 2014 9:54:00 PM GMT+03:00, LCD 47 <[email protected]> wrote:
> >On 1 July 2014, Bram Moolenaar <[email protected]> wrote:
> >> The main thing was to highlight one or a few characters at a fixed
> >> position in the text. Such as a parenthesis. Text is usually
> >> located by byte index, not character index, since it's quicker.
> >
> > True -- unless the column number comes from somewhere else, such
> >as a compiler's error message. Sometimes you don't get to choose.
>
> *Virtual* column number?
Yes.
> Compiler author must be crazy to write this, and as explained in the
> other thread (with a new patch for matchaddpos() to support screen
> cells) it is incorrect to blindly use it without setting settings to
> exactly those of the compiler.
I agree 100% that it's broken. They still do it.
For what it's worth, I had to look at the sources at many of said
compilers to get syntastic to understand their output, and using virtual
columns isn't *that* far fetched. Most of the time they just expand
tabs while parsing and don't bother keeping track of the original
offset. When they run into an error they just compute the column number
by adding the lengths of the whitespace and the tokens parsed so far.
Double width characters is a different story. Some compilers use
Unicode codepoints, others byte length, which is, again, broken. Still,
Vim's virtual columns is yet the best approximation of it.
> Can you please read that thread and explain whether and why you needed
> screen cells? I have a discussion there with an explanation why screen
> cells are inappropriate for matchaddpos(). OP was saying that you
> requested it, but I do not see why.
It might be needed because (1) some compilers *do* produce error
messages in virtual columns, and (2) if you get an offset in virtual
columns you *can't* translate it to a byte offset to feed matchaddpos(),
as you pointed out in a previous message (not with a reasonable effort
that is).
/lcd
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.