Dragging window between displays with different backing scale factors transiently changes pty dimensions, corrupting TUI scrollback #12923
Issue DescriptionWhen dragging a Ghostty window between displays with different backing scale factors on Mac, the pty dimensions transiently change to an incorrect value before self-correcting. The transient is long enough for TUI applications to redraw — and in Claude Code's case, irreversibly destroying the scrollback buffer. This has been confirmed in two ways:
Expected BehaviorDragging a Ghostty window between displays leaves pty dimensions (rows × columns) unchanged when the window is not resized by the user. Actual BehaviorThe pty dimensions transiently change to an incorrect value before self-correcting. The transient is long enough for TUI applications to redraw into the wrong size — in Claude Code's case irreversibly destroying the scrollback buffer. Observed via a tight TIOCGWINSZ polling loop while dragging between a 1× external display and a 2× Retina display: Moving to the Retina display: dimensions halve transiently The exact halving and doubling is consistent with the new display's backing scale factor being applied before the window geometry has fully settled. Setting both displays to the same backing scale factor (both 2×) eliminates the transient and produces no scrollback corruption. Reproduction Steps
To observe the transient dimension change directly, compile and run this before dragging: #include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
int main() {
struct winsize ws, prev = {0};
while (1) {
ioctl(0, TIOCGWINSZ, &ws);
if (ws.ws_col != prev.ws_col || ws.ws_row != prev.ws_row) {
printf("size changed: %d x %d\n", ws.ws_row, ws.ws_col);
fflush(stdout);
prev = ws;
}
}
}Confirmed non-reproduction: Setting both displays to the same backing scale factor (2×) and repeating the drag produces no transient and no scrollback corruption. Ghostty LogsNo response Ghostty VersionOS Version InformationmacOS Sequoia 15.x, M5 MacBook Pro (Linux only) Display ServerNone (Linux only) Desktop Environment/Window ManagerNo response Minimal Ghostty Configuration# empty configAdditional Relevant ConfigurationNo response I acknowledge that:
|
Replies: 2 comments
|
I could also reproduce this with |
#12925