Skip to content

Make File ▸ Close Editor (⌘W) close the active tab - #41

Merged
burhankhanzada merged 1 commit into
mainfrom
fix/close-editor
Oct 4, 2026
Merged

burhankhanzada merged 1 commit into
mainfrom
fix/close-editor

Conversation

@burhankhanzada

Copy link
Copy Markdown
Member

What and why

File ▸ Close Editor (⌘W) and File ▸ Revert File did nothing. Both read activeTabProvider, which only a tab's own close and context-menu paths ever write — switching tabs never does — so it was usually empty. Same cause as Help ▸ Welcome in #32, which noted this one.

They now ask the layout which tab is on screen: AppLayoutController.activeCenterLeaf().

  • Close Editor closes that tab as its own × does: a file's editor state goes with it, and a .cdl file's canvas with it. A tab that is not a file — a canvas, the welcome screen, settings, release notes — just closes, as ⌘W does in VS Code.
  • Revert File reverts the active tab's file (activeEditorFile), and does nothing when that tab is not a file.

How it was verified

  • dart analyze --fatal-infos — clean
  • flutter test — passing (pre-push)
  • Tried it in the running app — not yet

New: test/shell/close_editor_test.dart — closes the active file and its editor state; closes the tab on screen, not another; takes a circuit's canvas with its file; closes a non-file tab (settings); does nothing with no tab open.

Notes for the reviewer

activeTabProvider and tabsListProvider are still written by the tab's own close path and read by telemetry; nothing that acts on "the active editor" reads them any more. Removing them is a separate cleanup.

🤖 Generated with Claude Code

Close Editor and Revert File read activeTabProvider, which switching
tabs never updates, so it was usually empty and both did nothing. They
now ask the layout which tab is on screen
(AppLayoutController.activeCenterLeaf). Close Editor closes it as a
tab's own × does — a file's editor state goes with it, and a circuit's
canvas with its file — and closes non-file tabs too (a canvas, the
welcome screen, settings), as ⌘W does in VS Code. Revert File acts on
the active tab's file, and on nothing when that tab is not a file.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@burhankhanzada
burhankhanzada merged commit c600440 into main Oct 4, 2026
21 checks passed
@burhankhanzada
burhankhanzada deleted the fix/close-editor branch October 4, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant