fatih / vim-go

Go development plugin for Vim
https://www.patreon.com/bhcleek
Other
15.98k stars 1.45k forks source link

Position for identifier highlight(GoSameIds) is miscalculated when unicode character is present #3586

Closed dunric closed 1 year ago

dunric commented 1 year ago

What did you expect to happen?

Presence of a single- or double-byte unicode symbol should not affect correctness of code highlighting.

Following screenshot demonstrates correct behavior. fmt is a Go module identifier and is not preceded with an unicode symbol on particular row : image

What happened instead?

Identifier highlight starts off the actual identifier position.

Following screenshot demonstrates the issue. lib is also a Go module identifier but now it is preceded with an unicode symbol, in a first string argument of Println function. image

In the first case("bubble sort") the symbol is (0x21d2), two-byte char so highlighting starts off by two columns. In the second case("selection sort") the symbol is á (0xe1), single-byte char so highlighting starts off by one column.

Configuration (MUST fill this out):

Vim 9.0.1882, Linux x86_64

vim-go version:

current