Closed jessegrosjean closed 4 years ago
Never mind... chunk api is what I needed.
In case you're still watching this issue:
char
== a column isn't correct. It's probably fine for many use-cases, and your use-case may be one of them. But in the general case you need to think about handling graphemes, double-wide characters (e.g. kanji and chinese characters) etc. Correct text handling is hard.
I have a char_index and I would like to convert to a (line, column) point.
Untested but right now I think something like this will work:
I wonder if there's a more efficient approach though... seems that internally
char_to_line
probably already has easy/efficient access to the the column offset information. Could it (or maybe there's some other method) just return the line and offset so that the second call toline_to_char
isn't necessary.