Commit 041c369
committed
fix(chat): closing the chat tab closes it, instead of reopening on the right
Regression from #76, reported from a real build. A MOVE and a CLOSE both end in
panel.dispose(), and onDidDispose treated them identically — revealing the sidebar every
time. That was correct while the sidebar was home: surrendering the tab meant going home.
With chat.startLocation defaulting to `editor` it inverts into a trap. Closing the tab
pops the panel open on the right, and there is no way to put the chat away at all: close
the tab and the panel appears, close the panel and it returns with the next window. The
`else` branch was the sharp end — with no resolved sidebar view (the normal case now,
since the chat opens centred and nobody opens the secondary sidebar) it called
focusChatView() unconditionally, which is precisely what revealed the panel.
Dispose cannot see the difference on its own, so moveChatToSidebar announces itself with a
flag that dispose reads once and clears. A plain close now closes.
WHAT STILL HAPPENS ON A CLOSE: if a sidebar view is already resolved it still becomes live,
because otherwise the conversation would be live nowhere while a resolved view sat there
showing a stale hand-over card. Only the REVEAL is conditional — making a hidden view live
costs nothing and is correct the moment the user opens it.
Two existing tests asserted the old behaviour and were updated deliberately, not
mechanically:
- "a sidebar that was never resolved is revealed rather than assumed" asserted the reveal
on EVERY close. That was the bug, stated as a requirement. It now covers the move.
- the activeWebview invariant pinned an exact list of assignments, so adding a second
RESET read as a regression. It now says what it means: exactly one place points it at a
live surface, and at least one releases it.
Guards, each bypass-verified by reverting the fix:
- the resolved view force-opened on a plain close
- the no-view reveal escaping the `moving` branch (the reported bug)
- the flag never cleared, so the NEXT close reveals too
- dispose unable to see a move at all
- the flag set AFTER dispose, so the move reads it stale
- the resolved view never becoming live, which would leave the chat live nowhere
NOT in this change, both reported alongside it:
- The untitled tab at startup is not ours — LevelCode has no `workbench.startupEditor`
override anywhere in its source. That is the editor default or a user setting.
- The "ResizeObserver loop" console spam is INFO-level noise from VS Code's own webview
harness; we register no ResizeObserver. I could not reproduce a loop: a harness running
the real stylesheet at 280/320/340/360px, with the ASCII logo's clamp(5px, 3.6cqi, 13px)
genuinely in its variable range, reported 1 resize callback and 0 loop errors. Fixing
this bug removes the reported scenario anyway, since the sidebar view is no longer
force-opened. Not shipping a speculative CSS change for something I have not reproduced.
25 tests in chatSurface, 34 suites green.1 parent 4e6593b commit 041c369
2 files changed
Lines changed: 91 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| |||
2311 | 2314 | | |
2312 | 2315 | | |
2313 | 2316 | | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
2314 | 2326 | | |
| 2327 | + | |
2315 | 2328 | | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
2316 | 2333 | | |
2317 | 2334 | | |
2318 | | - | |
2319 | | - | |
2320 | | - | |
2321 | | - | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
2322 | 2338 | | |
2323 | 2339 | | |
2324 | | - | |
| 2340 | + | |
| 2341 | + | |
| 2342 | + | |
| 2343 | + | |
| 2344 | + | |
| 2345 | + | |
2325 | 2346 | | |
2326 | | - | |
| 2347 | + | |
2327 | 2348 | | |
2328 | 2349 | | |
2329 | 2350 | | |
| |||
2336 | 2357 | | |
2337 | 2358 | | |
2338 | 2359 | | |
2339 | | - | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
2340 | 2367 | | |
2341 | 2368 | | |
2342 | 2369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | | - | |
66 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
| |||
140 | 145 | | |
141 | 146 | | |
142 | 147 | | |
143 | | - | |
| 148 | + | |
144 | 149 | | |
145 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
146 | 157 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 158 | + | |
| 159 | + | |
151 | 160 | | |
152 | 161 | | |
153 | 162 | | |
| |||
354 | 363 | | |
355 | 364 | | |
356 | 365 | | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
357 | 406 | | |
0 commit comments