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
docs(glyphgrid): say what the top-layer skip really deviates from, and re-unify the subscription order
enesc0453fa5d4fa
diff --git a/src/renderer/glyphgrid/addon.ts b/src/renderer/glyphgrid/addon.tsindex 7549d98b5..293dc1699 100644--- a/src/renderer/glyphgrid/addon.ts+++ b/src/renderer/glyphgrid/addon.ts@@ -153,17 +153,17 @@ export class GlyphGridRendererAddonCore {this.focused = internals.hasFocus()this.lastCursorRow = this.cursorViewportRow()this.updateDims()- // Before the atlas subscription on purpose: these two reach xterm's own internals through the- // shell, so they are the pair that could plausibly throw, and a throw here leaves NO- // subscription behind. (The shell guards them anyway — see glyphgrid-attach.)+ // EVERY subscription goes last, and they go TOGETHER. The shell catches a failing construction+ // and restores the DOM renderer without ever holding an addon to dispose, so anything+ // subscribed before a throw is disposed by nobody and keeps the dead addon reachable from the+ // object it subscribed to. That is the whole invariant, and it does not care which of these is+ // likelier to throw — splitting them to put the "riskier" pair first only widens the window it+ // exists to close.+ this.atlasResetSub = this.atlas.onReset(() => this.handleAtlasReset())const onRegistered = internals.onDecorationRegisteredconst onRemoved = internals.onDecorationRemovedif (onRegistered) this.decorationSubs.push(onRegistered(() => this.handleDecorationChange()))if (onRemoved) this.decorationSubs.push(onRemoved(() => this.handleDecorationChange()))- // LAST, so nothing above can throw after the subscription exists: the shell catches a failing- // construction and restores the DOM renderer, and a subscription made before that throw would- // never be disposed by anyone.- this.atlasResetSub = this.atlas.onReset(() => this.handleAtlasReset())}// ---------------------------------------------------------------- xterm renderer surfacediff --git a/src/renderer/glyphgrid/decorations.ts b/src/renderer/glyphgrid/decorations.tsindex afc50f582..fd6823e21 100644--- a/src/renderer/glyphgrid/decorations.ts+++ b/src/renderer/glyphgrid/decorations.ts@@ -32,13 +32,17 @@ export interface DecorationReader {/*** The overrides a cell's decorations impose, or null.*- * WHY 'top' IS SKIPPED. xterm's own renderers walk decorations twice: once at cell level for the- * `bottom` layer (a background the text is drawn OVER) and once above the text for `top`. This- * engine has one cell pass, so it can honour the bottom layer exactly and cannot express the top- * one at all — and painting a top-layer decoration as a cell colour would put it UNDER the glyph,- * which is the opposite of what it asked for. Search highlights are bottom-layer, which is why this- * is enough to close L12; a top-layer decoration keeps rendering as nothing, the same as before.- * A decoration with no layer at all is BOTTOM, matching xterm's own `options.layer ?? 'bottom'`.+ * WHY 'top' IS SKIPPED, AND WHAT THAT COSTS. Both of xterm's renderers resolve decorations at CELL+ * level and do it twice in one pass: `bottom` BEFORE the selection is applied, `top` AFTER it — so+ * a top-layer decoration outranks the selection band, not merely the base colours. This engine+ * resolves a cell once, in the feed, with the selection last, and expressing "after the selection"+ * would mean a second override stage.+ *+ * That is a DEVIATION, said plainly rather than dressed up as something xterm cannot do either: a+ * top-layer decoration renders as NOTHING here. It costs nothing today — `registerDecoration` has+ * no caller anywhere in `src/`, and `@xterm/addon-search`, the reason this module exists, registers+ * its matches with no layer at all, which is BOTTOM by xterm's own `options.layer ?? 'bottom'`. If a+ * top-layer decoration is ever shipped, this function is where the second stage has to go.** LAST WRITER WINS, per channel, matching the callback order xterm hands out — two decorations on* one cell is already ambiguous, and agreeing with the renderer we are replacing is the only