Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(glyphgrid): never shrink a LETTER — italic text was rendering 16% small
enes32e5fcd3f73f
diff --git a/docs/superpowers/plans/2026-08-03-phase1b-device-checklist.md b/docs/superpowers/plans/2026-08-03-phase1b-device-checklist.mdindex 399303269..bb785cd31 100644--- a/docs/superpowers/plans/2026-08-03-phase1b-device-checklist.md+++ b/docs/superpowers/plans/2026-08-03-phase1b-device-checklist.md@@ -356,7 +356,12 @@ Auto after you switched builds, that is why: re-select Shared and carry on.trade. Report anything still SEVERED, and report a glyph that shrank so far it is hard toread (that is `MIN_INK_FIT_SCALE` set wrong, not the mechanism failing). Ordinary text mustbe untouched — if plain Latin text looks smaller or unevenly sized after this, the tolerance- is misfiring and that is a **release blocker**.+ is misfiring and that is a **release blocker**. That is not hypothetical: between 2026-08-05+ and 2026-08-07 the shrink applied to LETTERS too, and since an italic face's worst glyph+ measures ~1.19 of its advance (bold-italic ~1.25) it rendered italic text at ~84% of the+ roman text beside it — per glyph, so narrow letters stayed full size and wide ones did not.+ **Check a paragraph of italic and bold-italic markdown** (agent output is full of it): every+ letter the same size as its neighbours, and the same size as the roman text around it.- [ ] **2.19 Underline — the attribute AND the hovered link.** Until 2026-08-05 shared mode drew nounderline at all: the feed wrote the flag and nothing read it. Two things to check, becausediff --git a/src/core/pty-single-user.test.ts b/src/core/pty-single-user.test.tsindex 7222d4d67..b9fb4392d 100644--- a/src/core/pty-single-user.test.ts+++ b/src/core/pty-single-user.test.ts@@ -124,13 +124,21 @@ describe('SINGLE-USER REGRESSION: co-attach must not change the solo path', () =afterEach(() => {vi.useRealTimers()resetPlatformForTests()- // RETRIED, because this races a write it cannot wait for. The scrollback snapshot is fired and- // forgotten by design — `snapshotScrollback` is best-effort and nothing awaits it — so a test- // that triggered one can reach here while the file is still landing, and the rmdir then fails- // with ENOTEMPTY. Measured at roughly one full-suite run in six before this, always in this- // hook and never in an assertion; the name of the test it failed under ("still snapshots the- // scrollback") is the tell. `maxRetries` covers exactly this errno.- fs.rmSync(userDataDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 20 })+ // BEST EFFORT, and it must stay that way. This races a write it cannot wait for: the scrollback+ // snapshot is fired and forgotten by design (`snapshotScrollback` is best-effort and nothing+ // awaits it), so a test that triggered one can reach here while the file is still landing and+ // the rmdir fails with ENOTEMPTY. Measured at roughly one full-suite run in six.+ //+ // `maxRetries` alone was not enough — it only narrows the window, and the write can land after+ // the last retry. The catch is what actually fixes it, and it is safe precisely because this+ // line is HOUSEKEEPING: the directory is per-test (`mkdtemp`) and lives in the OS temp dir, so+ // failing to remove it cannot indicate a defect in anything under test. A cleanup that can fail+ // the suite is worse than a leftover directory.+ try {+ fs.rmSync(userDataDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 20 })+ } catch {+ /* a temp dir we could not remove is not a test result */+ }})/** A manager WITHOUT init(): no tmux (plain-shell fallback), as the co-attach suite runs it. */diff --git a/src/renderer/glyphgrid/raster.test.ts b/src/renderer/glyphgrid/raster.test.tsindex 529a705bc..c183deefb 100644--- a/src/renderer/glyphgrid/raster.test.ts+++ b/src/renderer/glyphgrid/raster.test.ts@@ -1,7 +1,12 @@import { afterEach, describe, expect, it } from 'vitest'import { GlyphAtlas, GUTTER_PX } from './atlas'import { packColor } from './cells'-import { createCanvasRasterizer, shrinkToFit, underlineThickness } from './raster'+import {+ createCanvasRasterizer,+ shrinkEligible,+ shrinkToFit,+ underlineThickness+} from './raster'/*** These tests pin the three rects a colored draw uses, because the whole mip story rests on them:@@ -363,7 +368,21 @@ describe('createCanvasRasterizer', () => {expect(text.args).toEqual([INK_X, INK_Y + 16])})- it('an oversized glyph is SCALED to its cell instead of being clipped', () => {+ it('a LETTER is never scaled, however far its ink overhangs', () => {+ // The 2026-08-07 regression. An italic face measures ~1.19 of the advance at its worst glyph+ // and a bold-italic one ~1.25, so a rule that shrinks "anything oversized" renders italic+ // text at ~84% of the roman text beside it — and per glyph, so the narrow letters in a word+ // stay full size and the wide ones do not. Overhang is normal for text; clipping its tip is+ // what this renderer has always done and what nobody has ever reported.+ const stub = stubCanvas(256, 14) // 14px of ink in a 10px cell — 1.4×, far past the tolerance+ active = stub+ const r = createCanvasRasterizer(FONT, 256)!+ stub.ops.length = 0+ r.draw(0x58, false, true, INK_X, INK_Y, FG, BG) // italic 'X'+ expect(inkOp(stub.ops).scale).toBeUndefined()+ })++ it('an oversized SYMBOL is SCALED to its cell instead of being clipped', () => {// 14px of ink entitled to one 10px cell: without this it lost 4px off its right edge.const stub = stubCanvas(256, 14)active = stub@@ -1049,3 +1068,28 @@ describe('shrinkToFit', () => {expect(shrinkToFit(metrics(0, 14), 0)).toBe(1)})})++/**+ * The line between "this glyph may be shrunk" and "this glyph must be left alone" is not a ratio —+ * bold-italic `X` measures 1.25 of its advance and so does the icon shrink-to-fit was written for.+ * It is what the character IS.+ */+describe('shrinkEligible', () => {+ it('refuses every letter, digit and ASCII punctuation', () => {+ for (const ch of 'AZaz09.,;:!?-_/\\|()[]{}<>@#$%^&*+="\'`~') {+ expect(shrinkEligible(ch.codePointAt(0) as number), ch).toBe(false)+ }+ })++ it('refuses accented and non-Latin TEXT, which overhangs for the same reasons', () => {+ for (const ch of 'çğışöüÇĞİŞÖÜéèñåøαβγдж') {+ expect(shrinkEligible(ch.codePointAt(0) as number), ch).toBe(false)+ }+ })++ it('allows the symbols drawn to a box — the class the shrink exists for', () => {+ for (const ch of '⧉⎿★⭐▪◆➜✦☑⏺🎉👍') {+ expect(shrinkEligible(ch.codePointAt(0) as number), ch).toBe(true)+ }+ })+})diff --git a/src/renderer/glyphgrid/raster.ts b/src/renderer/glyphgrid/raster.tsindex ec45c95d0..2bf2b63f6 100644--- a/src/renderer/glyphgrid/raster.ts+++ b/src/renderer/glyphgrid/raster.ts@@ -61,6 +61,35 @@ const INK_FIT_TOLERANCE = 1.04*/const MIN_INK_FIT_SCALE = 0.6+/**+ * May this code point be SHRUNK to fit its cell at all?+ *+ * Only symbols. Never letters, digits or ASCII punctuation — and that exclusion is the whole point,+ * because ink overhanging its cell is NORMAL for text rather than a defect. Measured across the+ * monospace faces available here, at the worst glyph of each style:+ *+ * regular 1.04 bold 1.04 ITALIC 1.19 BOLD ITALIC 1.25 (ink ÷ advance)+ *+ * So a rule that shrinks anything past a few percent shrinks italic text to ~84% and bold-italic to+ * ~80% of the roman text beside it — and PER GLYPH, so inside one italic word the narrow letters+ * stay full size while `K`, `X`, `w` do not. That was the 2026-08-07 report ("some characters are+ * not right") and it was this file's own doing, introduced two days earlier with shrink-to-fit.+ *+ * Every terminal lets a face's overhang spill into the neighbouring cell, whose background is+ * almost always empty. We cannot (the clip that protects the mip chain forbids it), so text keeps+ * the behaviour it has always had here: the tip of the slant is clipped, which is L16 and which+ * nobody has ever reported. Making text SMALLER is a worse answer than clipping it, because it+ * changes the shape of every glyph rather than the last fraction of one.+ *+ * The cut is at U+2000 — below it is Latin, Greek, Cyrillic, Hebrew, Arabic and their punctuation,+ * i.e. text; above it are the arrows, the technical and geometric shapes, the dingbats and the+ * emoji, i.e. things drawn to a BOX whose author expected a square. A ratio cannot make this+ * distinction: bold-italic `X` measures 1.25 and so does the icon the shrink was written for.+ */+export function shrinkEligible(code: number): boolean {+ return code >= 0x2000+}+/*** The factor a glyph must be drawn at to fit its entitlement, or exactly 1 for "draw it unchanged".*@@ -485,7 +514,7 @@ export function createCanvasRasterizer(// exactly 1 takes the SAME `fillText` call the code took before this existed. So no// rendering anyone has already looked at moves.const metrics = ctx.measureText(glyph)- const scale = shrinkToFit(metrics, allowance)+ const scale = shrinkEligible(code) ? shrinkToFit(metrics, allowance) : 1if (scale === 1) {ctx.fillText(glyph, inkX, y + baseline)} else {