zesterer / ariadne

A fancy diagnostics & error reporting crate
https://crates.io/crates/ariadne
MIT License
1.61k stars 72 forks source link

Add support for unicode width #46

Closed ratmice closed 1 year ago

ratmice commented 1 year ago

In just testing some byte offset to char index conversion code, I noticed https://github.com/zesterer/ariadne/issues/41

When testing with "🦀". Naively just modifying char_width() prints multiple instances of the unicode character in question. "🦀" becomes "🦀🦀",

I left this behavior enabled for whitespace since I believe it is a part of the treatment of '\t' tab characters.

This perhaps doesn't fully fix the issue as reported, they might need a boolean to Config setting, which sets things up to call either width and width_cjk, but I don't know the right behavior to shoot for regarding whitespace in cjk.

zesterer commented 1 year ago

Thanks, this seems like it's am improvement on master's behaviour if nothing else!