Skip to content

Comments

Fix block cursor to render text with cursorAccent color#118

Open
ncoop57 wants to merge 1 commit intocoder:mainfrom
ncoop57:main
Open

Fix block cursor to render text with cursorAccent color#118
ncoop57 wants to merge 1 commit intocoder:mainfrom
ncoop57:main

Conversation

@ncoop57
Copy link

@ncoop57 ncoop57 commented Jan 14, 2026

Problem

The cursorAccent theme property was defined in xtermjs' ITheme but never actually used. Block cursors rendered as opaque rectangles that completely cover the character underneath, making it invisible.

Solution

  • Added optional colorOverride parameter to renderCellText()
  • After drawing the block cursor, re-render the cell's text using cursorAccent as the color override

This is a minimal change that reuses the existing text rendering logic, ensuring proper handling of font styles, graphemes, and wide characters.

PR created with the assistance of SolveIT, manually reviewed, iterated, and tested personally.

@deansheather
Copy link
Member

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e50bdabc5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// 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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid repainting full-width glyph outside block cursor cell

Redrawing line[x] via renderCellText can repaint a double-width character (cell.width === 2) across both cells, but the block cursor background drawn just above still covers only one cell. In the default theme cursorAccent is the same as the background, so when the cursor lands on a full-width CJK glyph, the right half gets repainted in background color on the non-cursor cell and effectively disappears. This regression is introduced by the new redraw path and is reproducible whenever block cursor is positioned on wide characters.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants