Skip to content

fix: Cmd+W closing wrong window when Settings is open#802

Merged
datlechin merged 1 commit intomainfrom
fix/cmd-w-closes-wrong-window
Apr 20, 2026
Merged

fix: Cmd+W closing wrong window when Settings is open#802
datlechin merged 1 commit intomainfrom
fix/cmd-w-closes-wrong-window

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

Summary

  • Clear CommandActionsRegistry.shared.current in windowDidResignKey so stale main-window actions don't persist when a non-main window (Settings, Welcome) becomes key
  • Simplify the Close Tab button action by removing a redundant main-window coordinator fallback that resolvedCloseTabActions already covers

Root cause

CommandActionsRegistry was only cleared on windowWillClose, not on windowDidResignKey. When the user opened Settings (Cmd+,) from a main editor window, the registry retained the main window's commandActions. Pressing Cmd+W then resolved those stale actions via resolvedCloseTabActions and called closeTab() on the main window instead of closing the Settings window.

Test plan

  • Open a database connection, Cmd+, to open Settings, Cmd+W — only Settings should close
  • Open Settings from the Welcome window, Cmd+W — only Settings should close
  • Cmd+W on the Welcome window (no Settings) — Welcome should close normally
  • Cmd+W on a main editor tab — tab should close as before
  • Rapid Cmd+W spam with Settings open — no unexpected window closures

@datlechin datlechin merged commit e1a1816 into main Apr 20, 2026
2 checks passed
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