fix(editor): collapse the workspace split when the last buffer closes (T-459)
EditorRegistry.close() guarded its active-changed emit on `_activeId != null`, so closing the LAST buffer (active clears to null) emitted only editor.closed — never the active-changed(id:null) the editor extension listens for to call closeEditor(). editorOpen stayed true and the top split sat orphaned over the Claude pane. Always emit active-changed when the active buffer is removed, including the cleared-to-null case; the slot renderer already collapses correctly once editorOpen flips false. The existing extension test fabricated the null active-changed event, so it passed despite the registry never emitting it — that gap is why the bug shipped. Add a registry test that drives the real close() path, plus a slot_host widget test asserting the split (drag handle) drops out and the primary pane fills the column. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -180,8 +180,13 @@ class EditorRegistry {
|
||||
if (buf == null) return;
|
||||
_pathToId.remove(buf.path);
|
||||
if (_activeId == id) {
|
||||
// Promote the next buffer, or clear to null when this was the last one.
|
||||
// Emit active-changed in BOTH cases: a null id is the signal the editor
|
||||
// split collapses on (T-459). Guarding the emit on `_activeId != null`
|
||||
// suppressed exactly the last-buffer-closed event, leaving editorOpen
|
||||
// stuck true and the top split orphaned over the primary pane.
|
||||
_activeId = _buffers.values.isEmpty ? null : _buffers.values.first.id;
|
||||
if (_activeId != null) _emitActive();
|
||||
_emitActive();
|
||||
}
|
||||
_emit('editor.closed', {'id': id, 'path': buf.path});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user