Problem
There are two issues with how error locations are displayed:
1. Greedy version_loc
The version location captures the closing parenthesis when it shouldn't.
Example:
File "dune-project", line 1, characters 11-13:
(lang dune è)
Should be characters 11-12 (just è), not 11-13 (which includes the ))
2. Unicode length miscalculation for East Asian characters
East Asian characters are double-width in terminals, but the underline calculation doesn't account for this.
Example:
File "dune-project", line 1, characters 11-21:
(lang dune 中3.16文)
The string 中3.16文 is 6 characters but shows 10 carets because 中 and 文 are double-width.
Related
This was observed while working on #12794