Summary #
cursor-position counts bytes in :pre, so columns inflate for multi-byte UTF-8 (box-drawing, accented characters): the rendered cursor drifts and cursor-left/cursor-right can split a character.
Current behavior #
buffer.janetcursor-positioncarries aFIXME:;docs/runtime.mdlists it under "Known tradeoffs".- ui.rs already maps byte -> char for rendering; the Janet side is byte-oriented.
Proposed approach #
Make columns char- (or grapheme-) aware across cursor-position, cursor-left/cursor-right, the move-lines column clamp, and future column memory.
Scope / notes #
First surfaced by the multibuffer separator glyphs (since removed from the buffer text), but user-typed UTF-8 still triggers it, and maybe emojis will shit the bed too.
Spork has an UTF8 module, but it's not pure, self-contained Janet code which we can yank like I did with the regex.janet module. JPM is not really embeddable, I will have to look for a good solution for this shitfest. I hate UTF-8.