fix: glyph under the block cursor invisible on INVERSE/selected cells#86
Merged
Merged
Conversation
The cursor rect is painted in the cell's pre-swap fg; the glyph on it was recolored to the post-swap bg, and only under APP_CURSOR — a keypad mode unrelated to rendering. On a cell with the INVERSE flag or inside a selection the fg/bg swap made glyph and rect the same color: the character under the cursor disappeared (e.g. nvim's cursor cell, or selecting across the shell prompt). Recolor with the pre-swap cell bg whenever the cursor is shown (SHOW_CURSOR), unconditionally.
Harzu
approved these changes
Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The block cursor rect is painted in the cell's pre-swap fg color, but the glyph on top of it is recolored to the post-swap bg — and only when
APP_CURSORis set, a keypad/cursor-keys mode that has nothing to do with rendering.On a cell with the
INVERSEflag or inside a selection, the fg/bg swap has already happened by then, so glyph and cursor rect end up the same color: the character under the cursor disappears. Easy to hit in practice:Minimal repro in a plain shell:
Before:
X▮Z— the Y is invisible inside the cursor block. After:XYZwith the Y readable inside the block.Fix
Capture the cell's pre-swap bg and use it for the glyph whenever the cursor is shown on that cell (
SHOW_CURSOR), unconditionally — the cursor rect is painted in the pre-swap fg, so the pre-swap bg is the contrasting color regardless of INVERSE/selection. Also drops the unrelatedAPP_CURSORgate: without it, the glyph under the cursor was invisible in the (common) non-application-mode case too, whenever cell fg ≈ cursor color.