Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lib/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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':
Expand Down