grid: decide width policy where felis disagrees with wcwidth #15

Closed
opened 2026-10-01 12:50:21 +09:00 by natsukium · 1 comment
Owner

Places where felis's cell width differs from what applications compute, so the cursor desyncs. Each needs a policy decision (and a record in docs/explanation/data-model/grid-and-cells.md) before code.

  • U+00AD soft hyphen: felis 0 (folds into the previous cell); glibc, Vim and macOS libc 1. printf 'a\xc2\xadb'.
  • U+3164 Hangul filler: felis 0 (dropped at column 0); glibc and kitty 2. U+FFA0: felis 0, others 1. Comes from Unicode 16 making them Default_Ignorable, which unicode-width follows.
  • zwj_continues_into_prev (editing.rs ~630) folds any non-ASCII scalar after a ZWJ, not only Extended_Pictographic (UAX #29 GB11); with the .min(2) clamp in grapheme_width (screen.rs ~339) 👩‍字 is 2 cells where apps count 4, क‍ख‍ग 2 vs 3. The doc comment on extends_previous_grapheme claims a width-2 emoji gate the code does not have.
  • An emoji modifier folds into any base: a🏻b is 2 cells, apps count 3.
  • Mode 2027: DECRST is ignored but DECRQM answers \e[?2027;1$y (set) rather than ;3 (permanently set) (editing.rs ~2864), so an app cannot tell it cannot opt out.
  • Unicode version skew: unicode-width 0.2.2 encodes Unicode 17 (e.g. U+2630–2637 and U+268A–268F wide since 16, new emoji such as U+1FA89); older glibc and macOS libc count 1 or −1. Probably accept and document.
Places where felis's cell width differs from what applications compute, so the cursor desyncs. Each needs a policy decision (and a record in `docs/explanation/data-model/grid-and-cells.md`) before code. - U+00AD soft hyphen: felis 0 (folds into the previous cell); glibc, Vim and macOS libc 1. `printf 'a\xc2\xadb'`. - U+3164 Hangul filler: felis 0 (dropped at column 0); glibc and kitty 2. U+FFA0: felis 0, others 1. Comes from Unicode 16 making them Default_Ignorable, which unicode-width follows. - `zwj_continues_into_prev` (`editing.rs` ~630) folds any non-ASCII scalar after a ZWJ, not only Extended_Pictographic (UAX #29 GB11); with the `.min(2)` clamp in `grapheme_width` (`screen.rs` ~339) `👩‍字` is 2 cells where apps count 4, `क‍ख‍ग` 2 vs 3. The doc comment on `extends_previous_grapheme` claims a width-2 emoji gate the code does not have. - An emoji modifier folds into any base: `a🏻b` is 2 cells, apps count 3. - Mode 2027: DECRST is ignored but DECRQM answers `\e[?2027;1$y` (set) rather than `;3` (permanently set) (`editing.rs` ~2864), so an app cannot tell it cannot opt out. - Unicode version skew: unicode-width 0.2.2 encodes Unicode 17 (e.g. U+2630–2637 and U+268A–268F wide since 16, new emoji such as U+1FA89); older glibc and macOS libc count 1 or −1. Probably accept and document.
Author
Owner

The width-policy changes landed (e2f0c08e joins across a ZWJ only between pictographs; 51ccdf64 reports grapheme cluster mode as permanently set); the remaining open question is the Indic conjunct policy, tracked in #25.

The width-policy changes landed (e2f0c08e joins across a ZWJ only between pictographs; 51ccdf64 reports grapheme cluster mode as permanently set); the remaining open question is the Indic conjunct policy, tracked in #25.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
felis-terminal/felis#15
No description provided.