jmacdonald / amp

A complete text editor for your terminal.
https://amp.rs
Other
3.74k stars 106 forks source link

Symbol jump to a line with half-width katakana jumps to incorrect position #253

Open beansmayawait opened 2 years ago

beansmayawait commented 2 years ago

If you have something like let char: char = 'ア' // some extra text to jump to and try to symbol-jump to the text after the ア (this is a half-width katakana), the cursor goes 1 position after the correct destination.

Amazing editor, by the way!

oldaccountdeadname commented 2 years ago

If you have something like let char: char = 'ア' // some extra text to jump to and try to symbol-jump to the text after the ア (this is a half-width katakana), the cursor goes 1 position after the correct destination.

Yeah, there are some (many) rough spots around unicode handling of grapheme clusters with more than one codepoint. (In UTF-8, the half-width katakana looks to be 0xE3 0x82 0xA2, which counts for more graphemes than it actually is, thus causing cursor displacement.) There was a similar issue causing the addition of a trailing newline to fail, which was fixed in 10b02900 (PR #243 if I got that hash wrong). I don't think I've got time to fix it right now, but I don't think it would be awfully difficult if you want to take a look and put together a PR.