@devries-cameron20 / t3code Mirror · read-only / commits / a3708b5180
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 11:00 UTC

fix(web): concealed terminal text stays hidden under the cursor (#37141)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Wout Stiens committed Nov 15, 2026 at 15:05 UTC a3708b51802d33b75964c65f32b0d9784f96b33f
3 files changed +39 -6
apps/mobile/modules/t3-terminal/android/src/main/java/expo/modules/t3terminal/TerminalCanvasView.kt
+3 -2
@@ -331,8 +331,9 @@ internal class TerminalCanvasView(context: Context) : View(context) {
331 canvas.drawRect(left, top, right, bottom, paint)
332 val index = currentFrame.cursorY * currentFrame.cols + currentFrame.cursorX
333 val text = currentFrame.cellText[index]
334 - if (text.isNotEmpty()) {
335 - configureTextPaint(currentFrame.cellFlags[index], currentFrame.background)
334 + val flags = currentFrame.cellFlags[index]
335 + if (text.isNotEmpty() && flags and FLAG_INVISIBLE == 0) {
336 + configureTextPaint(flags, currentFrame.background)
337 canvas.drawText(text, left, top + baselineOffsetPx, paint)
338 }
339 }
apps/web/src/terminal/ghostty/renderer.browser.test.ts
+33
@@ -122,6 +122,39 @@ describe.each([1.25, 2.2])("renderGhosttySnapshot at a %sx device pixel ratio",
122 expect(pixelsOffBackground(context)).toBe(0);
123 });
124
125 + it("keeps concealed text and its decorations hidden, under a block cursor too", () => {
126 + const context = scaledContext(scale);
127 + const concealed = { ...blank, text: "█", invisible: true, underline: true };
128 + const snapshot = (cursorVisible: boolean): GhosttySnapshot => ({
129 + cols: 3,
130 + rows: 1,
131 + foreground: { r: 0, g: 0, b: 0 },
132 + background,
133 + cursor: { r: 0, g: 0, b: 0 },
134 + cursorX: 1,
135 + cursorY: 0,
136 + cursorVisible,
137 + cursorBlinking: false,
138 + cursorStyle: 1,
139 + dirtyRows: new Set([0]),
140 + rowData: [
141 + {
142 + cells: [blank, concealed, blank],
143 + text: "",
144 + isWrapContinuation: false,
145 + wrapsToNext: false,
146 + },
147 + ],
148 + });
149 + const options = { ...layout, context, forceFull: true };
150 +
151 + renderGhosttySnapshot({ ...options, snapshot: snapshot(false), cursorOn: false });
152 + expect(pixelsOffBackground(context)).toBe(0);
153 +
154 + renderGhosttySnapshot({ ...options, snapshot: snapshot(true), cursorOn: true });
155 + expect(isDarkAt(context, 15.7, 12.5)).toBe(true);
156 + });
157 +
158 // Cell 1 spans x 11.8 to 19.6 and row 0 spans y 4 to 21 in CSS pixels.
159 it.each([
160 ["right", "\ue0b4", { flat: 12.3, round: 19.1, neighbour: 0, outside: 11.3 }],
apps/web/src/terminal/ghostty/renderer.ts
+3 -4
@@ -344,15 +344,14 @@ export function renderGhosttySnapshot(options: {
344
345 for (let column = 0; column < row.cells.length; column += 1) {
346 const cell = row.cells[column];
347 + if (!cell || cell.invisible) continue;
348 const hoveredLink =
349 hoveredLinkRange !== null &&
350 rowIndex >= hoveredLinkRange.start.y &&
351 rowIndex <= hoveredLinkRange.end.y &&
352 (rowIndex > hoveredLinkRange.start.y || column >= hoveredLinkRange.start.x) &&
353 (rowIndex < hoveredLinkRange.end.y || column <= hoveredLinkRange.end.x);
353 - if (!cell || (!cell.underline && !cell.strikethrough && !cell.overline && !hoveredLink)) {
354 - continue;
355 - }
354 + if (!cell.underline && !cell.strikethrough && !cell.overline && !hoveredLink) continue;
355 context.fillStyle = cssColor(cell.foreground);
356 const left = padding + column * metrics.width;
357 if (cell.underline || hoveredLink) {
@@ -383,7 +382,7 @@ export function renderGhosttySnapshot(options: {
382 } else {
383 const cell = cells[snapshot.cursorX];
384 context.fillRect(left, top, width, height);
386 - if (cell?.text) {
385 + if (cell?.text && !cell.invisible) {
386 context.fillStyle = cssColor(snapshot.background);
387 if (isSolidPowerlineSeparator(cell.text)) {
388 fillSolidPowerlineSeparator(context, cell.text, left, top, metrics.width, height, 0);