Skip to content

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.

docs(glyphgrid): the separate alpha blend fixes the mip-frontier rim — say so where it is set

enes1c3878ce233b
diff --git a/src/renderer/glyphgrid/gl-webgl2.ts b/src/renderer/glyphgrid/gl-webgl2.ts
index 6d3ca319d..c4511241d 100644
--- a/src/renderer/glyphgrid/gl-webgl2.ts
+++ b/src/renderer/glyphgrid/gl-webgl2.ts
@@ -377,11 +377,22 @@ export function createWebgl2GL(canvas: HTMLCanvasElement): GlyphGL | null {
* compositing premultiplied — then lets 75% of the page through a pixel that is 50% covered. A
* bright halo along a soft edge, on the light theme especially.
*
- * It changes NOTHING that was already drawn: every source this renderer produced before the
- * plate became a quad is either fully opaque (cells, cursor overlay) or fully transparent (a
- * grid's zeroed buffer before its first packed row), and `srcA * srcA` equals `1 * srcA` at both
- * ends. The plate's antialiased corner is the first partial coverage in the pipeline, and this
- * is the factor that makes it composite as the coverage it claims.
+ * WHAT IT CHANGES, in three cases — and the third is a FIX, not a side effect:
+ * - **Fully opaque** sources (a packed cell, the cursor overlay): unaffected. `srcA * srcA` and
+ * `1 * srcA` are both 1.
+ * - **Fully transparent** sources (a grid's zeroed buffer before its first packed row):
+ * unaffected. Both are 0, and the destination keeps its own alpha either way.
+ * - **PARTIALLY transparent** sources, which the plate's antialiased corner is NOT the first of.
+ * `raster.ts` documents a pre-existing one and this blend improves it: the atlas is uploaded
+ * NON-premultiplied, so wherever a mip level averages a slot's opaque background against the
+ * page's transparent ground — the allocation frontier, the page's right/bottom remainder
+ * strip, and the whole page right after a `clearPage` repack — a level-2 texel comes out half
+ * brightness at half alpha, and `LINEAR_MIPMAP_LINEAR` is the min filter at any zoom below 1,
+ * i.e. in ordinary use. Under the old single-factor blend such a rim texel left `dstA = 0.75`,
+ * so the PLATE underneath it (and the page under that) showed through a cell that had already
+ * been painted — the rim's page-bleed half. With `ONE` on the source alpha the surface stays
+ * fully opaque there, and only the colour half of that residual is left (see `raster.ts` — the
+ * non-premultiplied UPLOAD is what still double-attenuates the rim's brightness).
*/
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA)
diff --git a/src/renderer/glyphgrid/raster.ts b/src/renderer/glyphgrid/raster.ts
index fd8879d7b..73acb7deb 100644
--- a/src/renderer/glyphgrid/raster.ts
+++ b/src/renderer/glyphgrid/raster.ts
@@ -158,6 +158,17 @@ function baselineIn(ctx: OffscreenCanvasRenderingContext2D, font: RasterFont): n
* premultiplied (`UNPACK_PREMULTIPLY_ALPHA_WEBGL` true) and blend `ONE, ONE_MINUS_SRC_ALPHA`, which
* makes the average correct instead of double-counted. Device evidence first — it is not built now.
*
+ * HALF OF THAT ESCALATION HAS SINCE LANDED, so do not re-do it and do not read the residual above
+ * as still whole. The BLEND half arrived with the rounded occlusion plate — `gl-webgl2.ts` now sets
+ * `blendFuncSeparate(SRC_ALPHA, ONE_MINUS_SRC_ALPHA, ONE, ONE_MINUS_SRC_ALPHA)`, i.e. `ONE` on the
+ * source ALPHA — which is what the plate's antialiased corner needed and which closes the
+ * PAGE-BLEED half of this rim on the way: a half-alpha rim texel used to leave the surface only
+ * three-quarters opaque, so the plate under a cell that had already been painted showed through it.
+ * It no longer does. What is left is the COLOUR half alone — the non-premultiplied UPLOAD still
+ * hands the blend an already-darkened average, so the rim reads slightly dark at heavy zoom-out.
+ * That, and only that, is what the device round now judges, and
+ * `UNPACK_PREMULTIPLY_ALPHA_WEBGL` is the whole of what would close it.
+ *
* The promise that actually matters, and the one the LOD derivation rests on, is about INK.
*
* Unpacked, the four things this file must not break:
diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsx
index a4a0b0968..08972f7d8 100644
--- a/src/renderer/nodes/TerminalNode.tsx
+++ b/src/renderer/nodes/TerminalNode.tsx
@@ -1249,6 +1249,15 @@ export function TerminalNode({
* `radius - border`, so a plate rounded by the OUTER radius would curve slightly tighter than
* the node's own clip all the way round the corner.
*
+ * ONE RADIUS AND ONE BORDER — exact for this node, an approximation in general.
+ * `borderBottomLeftRadius` is the HORIZONTAL half of a corner CSS allows to be elliptical, and
+ * `borderBottomWidth` is one of the TWO borders that meet at a bottom corner. Both collapse to a
+ * single number because `.term-node` is authored with one uniform radius and `1px` side and
+ * bottom borders. An elliptical radius or asymmetric side borders would need the vertical half
+ * and the side width as well — and an elliptical corner would additionally need the SDF to take
+ * a `vec2` radius, so this is a two-file change, not a wider `parseFloat`. Same instinct as the
+ * `%` refusal below: this is not a CSS length engine.
+ *
* Only the bottom corners are shaped, and the GL layer owns that rule rather than this call
* site — see `GridDrawParams.plateRadius`. The body is the node's last child, so its top
* corners butt against opaque chrome and are not corners on screen at all.
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index e6a3c2efb..77fb64640 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -1757,10 +1757,21 @@ body,
body, or stop the host being inset:0, and the plate silently under-covers again — the exact band
this design removed. Change either and the measurement must move to `.term-node__body`.
- ONE accepted degradation is left, and it is Phase 2's call (a rounded / stencilled plate),
- judged on the device checklist: the plate is a square rect while the node has border-radius
- 10px, so the body's corners read square in shared mode — the node's `overflow: hidden` clips DOM
- children, and the canvas is not one. */
+ THE PLATE'S SHAPE FOLLOWS THIS RULE'S SET, and that is now a live invariant rather than an
+ accepted degradation. The node's `overflow: hidden` clips DOM children and the canvas is not one,
+ so the plate cannot be clipped by `border-radius` — it draws its own: as of Phase 2 it is a
+ rounded quad whose BOTTOM two corners carry the node's own radius (read at register time from
+ this element's computed `border-bottom-left-radius` minus its border width, since the body is the
+ padding box — see `measurePlateRadius`), while its TOP two stay square.
+
+ Square on top is deliberate and load-bearing. `.term-node__body` is the node root's LAST child,
+ so its bottom edge IS the node's rounded bottom with nothing behind it but canvas, while its top
+ edge is an interior seam against opaque chrome (`.term-node__header`, the labels row,
+ `.term-node__find`, all of which paint their own `var(--panel)`). Rounding the top corners would
+ not shape a visible corner at all — it would carve two wedges of canvas OUT of the body, inside
+ the host's `6px`/`4px` padding where no cell quad covers them. **If the body ever stops being the
+ last child, or anything transparent is placed below it, that rule inverts and
+ `GridDrawParams.plateRadius` has to become a per-corner pair.** */
.term-node--glyphgrid,
.term-node--glyphgrid .term-node__body {
background: transparent;