Renderer resizes and fully repaints every frame at a fractional devicePixelRatio (and leaves seams between cell backgrounds)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- frontend
Research direction
Start in the CanvasRenderer.render() and resize() paths mentioned in the report, then reproduce the issue at a fractional devicePixelRatio such as 1.36. Verify the canvas dimensions are compared using the same integer sizing that resize() applies, and check that idle frames no longer resize or fully repaint and that coloured cell backgrounds have no visible seams.
Written by the indexing model from the issue text.
Description
Version: ghostty-web 0.4.0-next.20.g1858a59 (also current main, 1858a59)
What happens
With a non-integer window.devicePixelRatio (browser zoom other than 100%, a scaled display, e.g.
1.36 or 2.2), the canvas renderer calls resize() and does a full redraw on every animation
frame, about 60 times a second while nothing changes. The caret and output look "busy", and CPU
use goes up. Cell backgrounds are also drawn at fractional device-pixel edges, which leaves
hairline seams (a visible grid) over coloured backgrounds.
Cause
CanvasRenderer.render() checks
this.canvas.width !== D.cols * this.metrics.width * this.devicePixelRatio
canvas.width is always an integer and the right-hand side is fractional at a fractional DPR, so
the check is true on every frame and resize() runs again, forcing a full redraw.
Repro
Open the demo, set browser zoom to 110% (or run Chrome with --force-device-scale-factor=1.36),
then wrap term.renderer.resize to count calls: about 60/s while idle. At DPR 1 or 2: 0/s.
Fix suggestion
Compare against Math.round(cols * width * dpr) (as resize() sets it), or render at
Math.ceil(devicePixelRatio) and let the browser scale the canvas down. The second also removes
the seams. We work around it by setting renderer.devicePixelRatio = Math.ceil(window.devicePixelRatio)
after open(), re-applied on a resolution media-query change. That took idle resizes from 60/s
to 0 and removed the seams.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 182
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coder/ghostty-web
-
buffer translateToString()/getChars() return '' for empty cells, collapsing cursor-positioned textOpen
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
coder/ghostty-web#205 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
coder/ghostty-web#204 ·
-
Alt+<printable key> sends the bare key with no ESC prefix (readline/emacs/tmux meta bindings lost)Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
coder/ghostty-web#203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
coder/ghostty-web#199 ·
-
Public buffer getChars and translateToString truncate multi-codepoint graphemesPossibly taken @schickling-assistant claimed this 11 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 76/100
coder/ghostty-web#200 ·
All issues in coder/ghostty-web
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
Zettlr/Zettlr#6610 · 1 comment ·
Maintainers usually reply within 1 day
-
Feil lovtekst i bekreftelsen når leder melder unntak fra oppfølgingsplanPossibly taken @AudunSorheim claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
navikt/syfo-oppfolgingsplan-frontend#1110 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
db-ux-design-system/core-web#8461 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Cannot run an integration on windows when power shell is selected as the default profile terminalOpenPriority/Blocker Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
wso2/product-integrator#2767 ·
Maintainers usually reply within 1 day