Commit ea7b103
fix: prevent stale terminal data on tab switch — add chunkedTerminalWrite cancellation
chunkedTerminalWrite used requestAnimationFrame to write buffer chunks across
frames but had no cancellation. When switching tabs, old session's remaining
chunks continued writing stale data into the new session's terminal, causing
visual artifacts and garbled content.
- Add _chunkedWriteGen generation counter to abort in-flight chunked writes
- Bump gen early in selectSession() and SSE reconnect to immediately cancel
- Guard finish() so aborted writes don't flush SSE queue for wrong session
- Add fitAddon.fit() before buffer writes to sync terminal dimensions
- Add fitAddon.fit() in sendResize() to ensure local/server dim parity
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent bec8e2f commit ea7b103
2 files changed
Lines changed: 31 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1362 | 1362 | | |
1363 | 1363 | | |
1364 | 1364 | | |
| 1365 | + | |
| 1366 | + | |
1365 | 1367 | | |
1366 | 1368 | | |
1367 | 1369 | | |
| |||
2020 | 2022 | | |
2021 | 2023 | | |
2022 | 2024 | | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
2023 | 2029 | | |
2024 | 2030 | | |
2025 | 2031 | | |
| |||
2136 | 2142 | | |
2137 | 2143 | | |
2138 | 2144 | | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
2139 | 2150 | | |
2140 | 2151 | | |
2141 | 2152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
222 | 225 | | |
223 | 226 | | |
224 | 227 | | |
| |||
1033 | 1036 | | |
1034 | 1037 | | |
1035 | 1038 | | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
1036 | 1043 | | |
1037 | 1044 | | |
1038 | 1045 | | |
| |||
1049 | 1056 | | |
1050 | 1057 | | |
1051 | 1058 | | |
1052 | | - | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
1053 | 1063 | | |
1054 | 1064 | | |
1055 | 1065 | | |
| |||
1067 | 1077 | | |
1068 | 1078 | | |
1069 | 1079 | | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
1070 | 1086 | | |
1071 | 1087 | | |
1072 | 1088 | | |
| |||
1240 | 1256 | | |
1241 | 1257 | | |
1242 | 1258 | | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
1243 | 1262 | | |
1244 | 1263 | | |
1245 | 1264 | | |
| |||
0 commit comments