Fix block cursor to render text with cursorAccent color#118
Fix block cursor to render text with cursorAccent color#118ncoop57 wants to merge 1 commit intocoder:mainfrom
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 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); |
There was a problem hiding this comment.
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 👍 / 👎.
Problem
The
cursorAccenttheme property was defined in xtermjs'IThemebut never actually used. Block cursors rendered as opaque rectangles that completely cover the character underneath, making it invisible.Solution
colorOverrideparameter torenderCellText()cursorAccentas the color overrideThis 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.