Hi all,
The getpos(), col() and getcurpos() functions currently return the byte index
in a line. The setpos() and cursor() functions use the byte index to position
the cursor or to set a mark.
The language server protocol uses character index instead of byte index
in a line. I see that the various LSP Vim plugins have created their own
utility functions to convert between the byte index and the character index.
It will be better to extend the built-in function to use character indexes,
so that multiple plugins can use this.
What do you think about enhancing these functions like below?
getpos({expr}, [charcol])
col({expr}, [charcol])
setpos({expr}, {list}, [charcol])
cursor({list}, [charcol])
getcurpos([{winid} [, charcoal]})
In the above functions, if 'charcol' is set to true, then the returned column
number will be a character index. If 'charcol' is false or not specified
(the default), then the returned column number will be a byte index.
Thanks,
Yegappan