From a04e0965f255bccc0872ff4f2e63a6e44efd34a9 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 5 May 2026 08:42:23 +0800 Subject: [PATCH] Fix GhosttyCore scrollback cells always rendering with black colors getScrollbackCell() unconditionally packed RGB values into fgRgb/bgRgb even when colorFlags indicated no explicit color was set. This caused scrollback lines to render with rgb(0,0,0) instead of using terminal default colors. Now matches getCell()'s logic by checking colorFlags before setting fgRgb/bgRgb. Co-Authored-By: Claude Opus 4.7 --- packages/@wterm/ghostty/src/ghostty-core.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/@wterm/ghostty/src/ghostty-core.ts b/packages/@wterm/ghostty/src/ghostty-core.ts index 0a67716..cf3ee2e 100644 --- a/packages/@wterm/ghostty/src/ghostty-core.ts +++ b/packages/@wterm/ghostty/src/ghostty-core.ts @@ -257,14 +257,17 @@ export class GhosttyCore implements TerminalCore { const cell = parseCell(view, col * CELL_BYTES); freeBuffer(this.wasm, bufPtr, lineSize); - return { + const result: CellData = { char: cell.codepoint || 32, fg: DEFAULT_COLOR, bg: DEFAULT_COLOR, flags: cell.flags, - fgRgb: packRgb(cell.fgR, cell.fgG, cell.fgB), - bgRgb: packRgb(cell.bgR, cell.bgG, cell.bgB), }; + if (cell.colorFlags & 1) + result.fgRgb = packRgb(cell.fgR, cell.fgG, cell.fgB); + if (cell.colorFlags & 2) + result.bgRgb = packRgb(cell.bgR, cell.bgG, cell.bgB); + return result; } getScrollbackLineLen(offset: number): number {