Skip to content

Commit 15192cd

Browse files
committed
Fix tmux -CC attach not showing alternate screen (e.g., vim) correctly
When attaching to a tmux session where a pane is on the alternate screen, setTmuxState: swaps the primary/alt grid pointers but the read-only state used for rendering never got the updated content. Mark all cells dirty after the grid swap and after setAltScreen: writes via memcpy so that the incremental mergeFrom: sync copies the correct content.
1 parent 040a4d3 commit 15192cd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sources/VT100ScreenMutableState.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5820,6 +5820,7 @@ - (void)setAltScreen:(NSArray<NSData *> *)lines {
58205820
o++;
58215821
} while (o < self.altGrid.size.height && length > 0);
58225822
}
5823+
[self.altGrid markAllCharsDirty:YES updateTimestamps:NO];
58235824
}
58245825

58255826

@@ -5843,6 +5844,10 @@ - (void)setTmuxState:(NSDictionary *)state {
58435844
id<VT100GridReading> temp = self.altGrid;
58445845
self.altGrid = self.primaryGrid;
58455846
self.primaryGrid = temp;
5847+
// After swapping grid pointers, the read-only state's grids still reference old copies.
5848+
// Mark all cells dirty to force a full resync during mergeFrom:.
5849+
[self.primaryGrid markAllCharsDirty:YES updateTimestamps:NO];
5850+
[self.altGrid markAllCharsDirty:YES updateTimestamps:NO];
58465851
}
58475852

58485853
NSNumber *altSavedX = state[kStateDictAltSavedCX];

0 commit comments

Comments
 (0)