fix(website): correct block cursor rendering in browser terminal#192
fix(website): correct block cursor rendering in browser terminal#192snvshal wants to merge 2 commits into
Conversation
|
@snvshal is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d2c6b6ad9
ℹ️ 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".
| } | ||
|
|
||
| this.cursorElement.textContent = text; | ||
| const resolvedColor = getComputedStyle(this.cursorElement).color; |
There was a problem hiding this comment.
Compute blink text color from underlying glyph style
In LiteTerminal.configureCursorElement, resolvedColor is captured from getComputedStyle(this.cursorElement) after applying the lite-terminal-cursor class, and that class now sets color: var(--cursor-block-fg, #000) in globals.css. For default (unstyled) text this resolves to the cursor block color instead of the line’s glyph color, so during the 50% blink phase (transparent background) the character under the cursor is drawn with the wrong color or effectively disappears on dark themes.
Useful? React with 👍 / 👎.
| const cursorChar = segment.text[offsetInSegment]; | ||
| const afterCursor = segment.text.slice(offsetInSegment + 1); |
There was a problem hiding this comment.
Avoid slicing cursor glyph by UTF-16 code unit
renderLineContent now pulls the cursor cell with segment.text[offsetInSegment] and slice(offsetInSegment + 1), which split by UTF-16 code units rather than full grapheme clusters. If the cursor is on a multi-code-unit character (for example an emoji at the start of a line), this produces broken surrogate halves and corrupts what is rendered around the cursor, which is a regression introduced by the new cursor-char extraction path.
Useful? React with 👍 / 👎.
Summary
Fix the custom browser terminal block cursor in
examples/websiteso it behaves more like a realterminal.
What changed
Before
Before video:
website-terminal-block-cursor-before.mp4
After
After video:
website-terminal-block-cursor-after.mp4
Scope
This only changes the browser terminal UI in:
examples/website/app/components/lite-terminal/LiteTerminal.tsexamples/website/app/globals.css