Repository navigation
Make File ▸ Close Editor (⌘W) close the active tab - #41
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()..cdlfile'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.activeEditorFile), and does nothing when that tab is not a file.How it was verified
dart analyze --fatal-infos— cleanflutter test— passing (pre-push)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
activeTabProviderandtabsListProviderare 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