Skip to content

fix: full repaint on resume to fix transparency artifacts in Kitty#928

Open
acegikmoo wants to merge 2 commits intoanomalyco:mainfrom
acegikmoo:resume-transparent
Open

fix: full repaint on resume to fix transparency artifacts in Kitty#928
acegikmoo wants to merge 2 commits intoanomalyco:mainfrom
acegikmoo:resume-transparent

Conversation

@acegikmoo
Copy link
Copy Markdown

Fixes #922

When Kitty resumes after SIGCONT, it restores the alternate screen buffer with transparency compositing applied. The diff render then skips cells that haven't changed, so the transparency persists since nothing in the UI actually changed during suspension.

The fix is to call lib.render with force=true right after currentRenderBuffer.clear() in resume(). This bypasses the diff and repaints every cell immediately, overwriting whatever Kitty had in its restored buffer.

This is also why resizing fixes it, buffer.resize() clears both buffers which makes the diff see everything as dirty and forces a full repaint as a side effect.

this.currentRenderBuffer.clear(this.backgroundColor)
// Normal diff skips unchanged cells leaving transparency visible. force=true repaints all.
this.lib.render(this.rendererPtr, true)

@kommander
Copy link
Copy Markdown
Collaborator

this.currentRenderBuffer.clear(this.backgroundColor) was supposed to do that, but I guess behaviour might have changed recently when this.backgroundColor has alpha=0 it does not reset the cells. When we do a force re-render it will draw all cells and the currentRenderBuffer.clear becomes futile, so we would not need to do both.

I wonder if that is easily coverable with a test maybe, so it doesn't regress again 🤔

@acegikmoo acegikmoo force-pushed the resume-transparent branch from e1baf0b to b21b942 Compare April 10, 2026 05:34
@acegikmoo
Copy link
Copy Markdown
Author

acegikmoo commented Apr 10, 2026

this.currentRenderBuffer.clear(this.backgroundColor) was supposed to do that, but I guess behaviour might have changed recently when this.backgroundColor has alpha=0 it does not reset the cells. When we do a force re-render it will draw all cells and the currentRenderBuffer.clear becomes futile, so we would not need to do both.

I wonder if that is easily coverable with a test maybe, so it doesn't regress again 🤔

removed the clear() call since the force render covers it. Also added a test that spies on lib.render and asserts force=true is passed on resume, so this should be covered against regression ig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transparency artifacts after Ctrl+Z suspend/resume in terminals with background opacity

2 participants