diff --git a/lib/renderer.ts b/lib/renderer.ts index 0e682be..a0fcb48 100644 --- a/lib/renderer.ts +++ b/lib/renderer.ts @@ -585,7 +585,7 @@ export class CanvasRenderer { * Render a cell's text and decorations (Pass 2 of two-pass rendering) * Selection foreground color is applied here to match the selection background. */ - private renderCellText(cell: GhosttyCell, x: number, y: number): void { + private renderCellText(cell: GhosttyCell, x: number, y: number, colorOverride?: string): void { const cellX = x * this.metrics.width; const cellY = y * this.metrics.height; const cellWidth = this.metrics.width * cell.width; @@ -604,8 +604,10 @@ export class CanvasRenderer { if (cell.flags & CellFlags.BOLD) fontStyle += 'bold '; this.ctx.font = `${fontStyle}${this.fontSize}px ${this.fontFamily}`; - // Set text color - use selection foreground if selected - if (isSelected) { + // Set text color - use override if provided, otherwise selection or cell color + if (colorOverride) { + this.ctx.fillStyle = colorOverride; + } else if (isSelected) { this.ctx.fillStyle = this.theme.selectionForeground; } else { // Extract colors and handle inverse @@ -720,6 +722,12 @@ export class CanvasRenderer { case 'block': // Full cell block this.ctx.fillRect(cursorX, cursorY, this.metrics.width, this.metrics.height); + + // Re-draw the character under the cursor with cursorAccent color + const line = this.currentBuffer?.getLine(y); + if (line?.[x]) { + this.renderCellText(line[x], x, y, this.theme.cursorAccent); + } break; case 'underline':