Decide on an ambiguous-width-as-wide setting #16

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

East Asian Ambiguous characters (※ ○ ① ★ ─ α, and Private Use, which includes Nerd Font icons) are always one cell in felis. Vim with set ambiwidth=double (or a setcellwidths() table) assumes two, so the cursor and the text drift apart. With #10 these characters render inside their one cell, so ambiwidth=single is a working default.

Peers: kitty, Ghostty, Alacritty and foot have no such setting; WezTerm (treat_east_asian_ambiguous_width_as_wide), iTerm2, Terminal.app, VTE and xterm (-cjk_width) offer one, default narrow.

Run principle-check before any work. If accepted, the daemon (grid widths) and the client (glyph footprint in GlyphIndex::raster_px) must agree, so it is a session-level setting rather than a client-only knob, and every width consumer (grid, pre-edit, bars, capture) must read it.

East Asian Ambiguous characters (※ ○ ① ★ ─ α, and Private Use, which includes Nerd Font icons) are always one cell in felis. Vim with `set ambiwidth=double` (or a `setcellwidths()` table) assumes two, so the cursor and the text drift apart. With #10 these characters render inside their one cell, so `ambiwidth=single` is a working default. Peers: kitty, Ghostty, Alacritty and foot have no such setting; WezTerm (`treat_east_asian_ambiguous_width_as_wide`), iTerm2, Terminal.app, VTE and xterm (`-cjk_width`) offer one, default narrow. Run principle-check before any work. If accepted, the daemon (grid widths) and the client (glyph footprint in `GlyphIndex::raster_px`) must agree, so it is a session-level setting rather than a client-only knob, and every width consumer (grid, pre-edit, bars, capture) must read it.
Author
Owner

Decided against it for now.

  • The cell width of an ambiguous character is counted by every program that draws to the screen, not only by the terminal: readline, ncurses, tmux and most CLI tools follow the C library's wcwidth, which gives one cell under a UTF-8 locale. A wide setting in the terminal alone aligns Vim and misaligns everything else; it only works when the user also patches the locale and every program agrees.
  • Private Use is ambiguous too, so a wide setting breaks Nerd Font icons and box drawing; ambiwidth=single with per-range setcellwidths() adjustments is the common setup in Japanese-language environments today.
  • Since #10, an ambiguous glyph is fitted into its one cell, so ambiwidth=single already renders correctly.
  • Supporting it would be a session-level setting read by every width consumer (grid, pre-edit, bars, capture). Principle 1 asks for a named need before taking on that cost, and kitty, Ghostty, Alacritty and foot get by without one.

Revisit if a concrete report shows felis unusable in an environment that requires ambiguous-as-wide. Then also compare a cell-width table (the analogue of Vim's setcellwidths()) against a single boolean.

Decided against it for now. - The cell width of an ambiguous character is counted by every program that draws to the screen, not only by the terminal: readline, ncurses, tmux and most CLI tools follow the C library's `wcwidth`, which gives one cell under a UTF-8 locale. A wide setting in the terminal alone aligns Vim and misaligns everything else; it only works when the user also patches the locale and every program agrees. - Private Use is ambiguous too, so a wide setting breaks Nerd Font icons and box drawing; `ambiwidth=single` with per-range `setcellwidths()` adjustments is the common setup in Japanese-language environments today. - Since #10, an ambiguous glyph is fitted into its one cell, so `ambiwidth=single` already renders correctly. - Supporting it would be a session-level setting read by every width consumer (grid, pre-edit, bars, capture). Principle 1 asks for a named need before taking on that cost, and kitty, Ghostty, Alacritty and foot get by without one. Revisit if a concrete report shows felis unusable in an environment that requires ambiguous-as-wide. Then also compare a cell-width table (the analogue of Vim's `setcellwidths()`) against a single boolean.
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#16
No description provided.