trufflesuite / truffle

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
14.02k stars 2.31k forks source link

Line and column numberings in debugger don't account for combining characters / grapheme clusters #4707

Open haltman-at opened 2 years ago

haltman-at commented 2 years ago

Issue

Now that #4706 is merged, the debugger will no longer count an astral-plane character as two characters instead of one for the purpose of line/column numbering. However, this still leaves potential problems when comining characters are used, since the debugger only knows about code points, not grapheme clusters. So, we might want to have a way to get the column numberings in terms of grapheme clusters, instead of just in terms of code points.

That said, Solidity probably does things in terms of code points, not grapheme clusters, so it's possible this would have to be in addition to how we do things currently. Like, we might want to report column numbers in terms of code points for most purposes, but use the grapheme-cluster numbers for the purpose of displaying the carets in the debugger? It's the carets I was thinking of when writing this issue. Fullwidth characters might also pose a problem here.

Environment

haltman-at commented 2 years ago

Oh, and bidirectional text, let's not forget that. :P