feat(render): draw the cursor in screenshots - #86
Closed
Ayman Bagabas (aymanbagabas) wants to merge 3 commits into
Closed
feat(render): draw the cursor in screenshots#86Ayman Bagabas (aymanbagabas) wants to merge 3 commits into
Ayman Bagabas (aymanbagabas) wants to merge 3 commits into
Conversation
A screenshot showed the grid but never where the terminal was about to write, so a reader could not tell an editor's caret position, whether a program had hidden the cursor, or which mode it was in. The emulator now reports visibility (`DECTCEM`) and shape (`DECSCUSR`), and the renderer draws the cursor after the text pass: a block fills the cell, an underline sits on its bottom edge, and a bar on its left. A block redraws the character beneath it in the cell's background color, so it stays readable rather than being swallowed. The redraw goes through the same path as the text pass, which keeps two cases right that a naive redraw gets wrong: a double-width character is covered across both of its cells instead of being clipped and squashed into one, and a nerd font glyph comes back as a vector glyph rather than as a character the text font has no glyph for. Blink is deliberately not represented; a screenshot is a single moment, and a blinking cursor is drawn in the half of the cycle where it shows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
This was referenced Aug 4, 2026
Ayman Bagabas (aymanbagabas)
marked this pull request as ready for review
August 4, 2026 21:07
Member
Author
|
cpendery (@cpendery) third of the stack, on top of #84 → #85. Only the last commit is new here. Please review #84 and #85 first. |
Brings main's move of the request types out of the core crate down the stack. The screenshot keeps main's signature and error handling, and holds the state guard across both the emulator borrow and the cursor lookup so a single lock covers the whole render. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Ayman Bagabas (aymanbagabas)
changed the base branch from
main
to
feat/osc-colors
August 5, 2026 17:49
Member
Author
|
Superseded: reopening this from a branch in Same commits, same branch name; the replacement is linked below. |
Member
Author
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.
Third of a three PR stack: #84 → #85 → #86. Only the last commit is new here; a cross-repo PR cannot be based on a fork branch, so GitHub shows the whole stack. Review
feat(render): draw the cursor in screenshots.A screenshot showed the grid but never showed where the terminal was about to write. You could not tell an editor's caret position, whether a program had hidden the cursor, or which mode it was in.
Before / after
The same session, screenshotted by the same command. The cursor is parked mid-word on
The:The emulator now reports visibility (
DECTCEM,CSI ?25 handl) and shape (DECSCUSR,CSI Ps SP q). The renderer draws the cursor after the text pass: a block fills the cell, an underline sits on its bottom edge, a bar on its left.Visibility matters as much as position. Full-screen programs hide the cursor while repainting, so a screenshot that ignored
DECTCEMwould show one parked wherever the last write happened to land.The cursor never hides content
A block redraws the character beneath it in the cell background, the way a terminal does. The redraw goes through the same path as the text pass, which keeps right two cases a naive redraw gets wrong:
日)The cursor follows a color a program sets
OSC 12sets the cursor color andOSC 112resets it, both from #85. The cursor had nothing to paint until this PR, so this is where they become visible. One session, screenshotted after each step, cursor parked on theq:OSC 12sets#ff8700OSC 112resetsThe default cursor color follows the profile foreground, so the block is the same grey as the text. The
qstays legible in all three.Notes for review
Emulator::cursoris relative to the visible screen, soscreenshot --fulloffsets it past the scrollback above.HollowBlock(what it draws for an unfocused window) maps toBlock, since a headless terminal has no notion of focus. ItsHiddenshape means the same as the mode being off.