v0.2.8
Wide characters and fallback glyphs
- The grid stays on its cells whatever the font draws. Glyph widths follow the
wcwidthconvention every terminal uses: CJK, Hangul, and emoji-presentation clusters take two cells, everything else one, from Unicode tables rather than the font. A cluster the font draws off its cell count — a star or a check the monospace font lacks, an ideograph a CJK fallback draws full-width — is boxed and scaled to fit its cells so borders and columns never drift, whatever the viewer's fallback fonts are. - Grapheme clusters are the unit. A ZWJ family, a flag, a keycap, a combining sequence is one cluster, one advance, one paint, never split by a wrap, a truncation, or a gesture.
clusterWidth,clusterAdvances,graphemes, andtextCellsare exported for code that lays out text of its own. - Latent bug fixed. Per-character data (
advances,charInline) was indexed by code point while the text was indexed by code unit, so anything astral — every emoji — shifted the per-character data after it by one.
The grid paints the selection
- A light-DOM selection is painted on the grid as reverse video — each cell's own color and background swap, theme colors where none — in both modes and for every kind of selection (a text-mode drag, a semantic double- or triple-click, a keyboard extension). Plain text still highlights as the theme invert; colored text now highlights as a band of its own color, and a focus-inverted control re-inverts correctly. A grid-mode drag on the
<pre>still uses the browser's::selection, so colored text highlights differently under a grid drag than any other selection, a documented deviation. - Text-mode drags are routed by cell. A primary press in
select="text"on non-interactive text is the engine's: it maps the cell to the character under the glyph you see, then extends by cluster; Shift extends the existing selection, double- and triple-click select the word or paragraph, keyboard extension stays native. The browser is never asked which character sits under a mouse, so a drifted native glyph cannot pick its neighbor.
Touch
- Long-press selects the paragraph you touch. In grid mode, a scroll container's whole subtree takes pointer events on touch devices, so a long-press selects the element's text under your finger instead of the first leaf in the container. Version 0.2.7 fixed this only for the container itself, and the fixture only "worked" because its target happened to be the first leaf.
Playground
- The default sample restores its original glyphs —
★ star,→ share,✎ edit me— which the wide-character fix now keeps on the grid whatever the font. - The header controls match heights and small alignment tweaks.
Full changelog: v0.2.7...v0.2.8