Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renderers (Metal and OpenGL) should clip terminal if terminal grid size mismatches physical window #4523

Closed
mitchellh opened this issue Jan 3, 2025 · 0 comments · Fixed by #5265
Labels
Milestone

Comments

@mitchellh
Copy link
Contributor

Both Metal and OpenGL have something like the following:

// If our terminal screen size doesn't match our expected renderer
// size then we skip a frame. This can happen if the terminal state
// is resized between when the renderer mailbox is drained and when
// the state mutex is acquired inside this function.
//
// For some reason this doesn't seem to cause any significant issues
// with flickering while resizing. '\_('-')_/'
if (grid_size.rows != state.terminal.rows or
grid_size.columns != state.terminal.cols)
{
return;
}

In this case, we just stop rendering which makes it look like the terminal is hanging. We should clip the terminal area (if it's bigger than our window) or blank the padding (if it's smaller) in this scenario.

The only known way to trigger this is DECCOLM, so it's low priority since almost nothing uses this. But notably vtetest uses this and it makes it appear like we perform much worse than we do.

@mitchellh mitchellh added this to the 1.0.2 milestone Jan 4, 2025
qwerasd205 added a commit to qwerasd205/ghostty that referenced this issue Jan 20, 2025
…org#4523)

This significantly improves the robustness of the renderers since it
prevents synchronization issues from causing memory corruption due to
out of bounds read/writes while building the cells.

TODO: when viewport is narrower than renderer grid size, fill blank
margin with bg color- currently appears as black, this only affects
DECCOLM right now, and possibly could create single-frame artefacts
during poorly managed resizes, but it's not ideal regardless.
qwerasd205 added a commit to qwerasd205/ghostty that referenced this issue Jan 20, 2025
…org#4523)

This significantly improves the robustness of the renderers since it
prevents synchronization issues from causing memory corruption due to
out of bounds read/writes while building the cells.

TODO: when viewport is narrower than renderer grid size, fill blank
margin with bg color- currently appears as black, this only affects
DECCOLM right now, and possibly could create single-frame artefacts
during poorly managed resizes, but it's not ideal regardless.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant