On 4 July 2014, Павлов Николай Александрович <[email protected]> wrote:
> Are you sure you need exactly screen cells? There are the following
> possible ways to identify position inside a string:
> 
> 1. Byte offset.
> 2. Unicode codepoints offset.
> 3. Composed characters offset (one "composed character" is "one
>    Unicode codepoint with attached composing characters (if any)").
> 4. Screen cells offset.
> 
> I doubt anybody will use 4. outside of a editor because it is hard
> to calculate.

    Sadly, the fact that you doubt it hasn't stopped anybody yet. :)
Here's a short list of syntax checkers that do that, in no particular
order:

* Haskell hdevtools
* Haskell HLint 
* Haskell scan
* PHP_CodeSniffer
* HTML tidy
* GNU Bison
* sparse semantic parser for C
* Splint static checker for C
* msgfmt from GNU gettext
* Racket
* code-ayatollah linter for Racket
* R module svtools
* R module lint
* JSHint
* JSXHint

... and probably others I don't remember right now.

> There are two settings that affect 4. and are only defined in a
> editor: &tabstop and &ambiwidth.

    Yup.  The checkers above either have their own config option for
&tabstop, or hardcode it (typically to 4 or 8).  They also generally
don't care about &ambiwidth, and they can get away with that most of the
time, since source code is largely ASCII.

> *You must not use screen cells offset with editor settings if you
> received it from another source.* It is incorrect: you need settings
> from another source, not from this instance of editor.

                        True.  Please suggest a better way to deal with the 
above.

> And ***do never use screen cells to count characters***. Code that
> assumes any fixed amount of Unicode codepoints per one cell is
> brain-damaged, broken and wrong.

    True.  Please suggest a better way to deal with the above.

> For this patch I heard the following use cases:
> 
> 1. matchparen. Will happily live with byte offset.
> 2. Highlighting of errors from some source. May not use screen cells
>    under any circumstances for the reasons explained above.

    Yet Vim's errorformat already has %v. :)

> 3. I think that things like Conque may also benefit from this, but
>    they do not need screen cells as well.

    /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.

Raspunde prin e-mail lui