Intl.Segmenter can group Indic conjuncts and spacing marks into one grapheme even when wcwidth-style terminals allocate multiple cells. Count visible consonants after marks and Unicode spacing marks separately while preserving zero-width exceptions.
This is a compatibility heuristic. Unicode Spacing_Mark indicates positive advance, not a full terminal cell; Kitty keeps many Indic continuations in the initial cell, while xterm-style terminals advance for them, so Pi overcounts some clusters in Kitty.
Overcounting causes horizontal drift, but undercounting can trigger terminal autowrap, so this change favors overcounting.
Clusters can contain repeated marks and mark-consonant continuations, so this implementation leaves their widths uncapped. Collapsing them would undercount terminals that advance for every visible continuation.
Mode 2027 does not report cluster widths, so Pi still needs local width calculations. This change does not implement OSC 66, which would be preferable where supported.
Fixes#6124
Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
Image.render() previously emitted the imageFallback line without
truncateToWidth. Long absolute paths (common when callers pass a
filename) exceeded the terminal width and crashed the TUI.
- imageFallback: home-shorten paths to ~/...; OSC 8 file:// link when
hyperlinks are available and the path is absolute
- Image.render: truncate fallback lines to the render width
- tests for shorten, hyperlink, basename, and width clamp
Co-authored-by: Moritz Hofmann <Moritz.Hofmann@aimentum.de>
Undo snapshots now restore paste content and counters alongside editor text. Paste marker renumbering shifts registry entries in ascending ID order before rewriting markers, preventing literal or incorrect paste content on submit.\n\nCloses #6844
When pi exits, the reverse-video cursor character remains visible on
the editor prompt line. Combined with the terminal's own cursor below,
this creates the appearance of two cursors, which is confusing.
Overwrite the inverted cursor with a normal space before exiting.