Skip to content

Commit 295dac6

Browse files
committed
fix: checkmark/active indicators not getting removed when tab is closed
1 parent 77aabdb commit 295dac6

4 files changed

Lines changed: 37 additions & 0 deletions

File tree

src/extensions/default/Git/src/Panel.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,6 +1501,17 @@ define(function (require, exports) {
15011501
handleGitCommit(lastCommitMessage[ProjectManager.getProjectRoot().fullPath], false, COMMIT_MODE.DEFAULT);
15021502
});
15031503

1504+
// When the panel tab is closed externally (e.g. via the × button),
1505+
// update the toolbar icon and menu checked state to stay in sync.
1506+
WorkspaceManager.on(WorkspaceManager.EVENT_WORKSPACE_PANEL_HIDDEN, function (event, panelID) {
1507+
if (panelID === "main-git.panel" && gitPanel) {
1508+
Main.$icon.toggleClass("on", false);
1509+
Main.$icon.toggleClass("selected-button", false);
1510+
CommandManager.get(Constants.CMD_GIT_TOGGLE_PANEL).setChecked(false);
1511+
Preferences.set("panelEnabled", false);
1512+
}
1513+
});
1514+
15041515
exports.init = init;
15051516
exports.refresh = refresh;
15061517
exports.toggle = toggle;

src/extensionsIntegrated/CustomSnippets/main.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,14 @@ define(function (require, exports, module) {
255255
});
256256
}
257257

258+
// When the panel tab is closed externally (e.g. via the × button),
259+
// update the menu checked state to stay in sync.
260+
WorkspaceManager.on(WorkspaceManager.EVENT_WORKSPACE_PANEL_HIDDEN, function (event, panelID) {
261+
if (panelID === PANEL_ID && customSnippetsPanel) {
262+
CommandManager.get(MY_COMMAND_ID).setChecked(false);
263+
}
264+
});
265+
258266
AppInit.appReady(function () {
259267
CommandManager.register(MENU_ITEM_NAME, MY_COMMAND_ID, showCustomSnippetsPanel);
260268
// Render template with localized strings

src/extensionsIntegrated/DisplayShortcuts/main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,5 +538,15 @@ define(function (require, exports, module) {
538538
KeyBindingManager.on(KeyBindingManager.EVENT_KEY_BINDING_REMOVED, _updateKeyBindings);
539539
KeyBindingManager.on(KeyBindingManager.EVENT_NEW_PRESET, _updatePresets);
540540
KeyBindingManager.on(KeyBindingManager.EVENT_PRESET_CHANGED, _updatePresets);
541+
542+
// When the panel tab is closed externally (e.g. via the × button),
543+
// update the menu checked state and clean up resources.
544+
WorkspaceManager.on(WorkspaceManager.EVENT_WORKSPACE_PANEL_HIDDEN, function (event, panelID) {
545+
if (panelID === TOGGLE_SHORTCUTS_ID && panel) {
546+
destroyKeyList();
547+
_clearSortingEventHandlers();
548+
CommandManager.get(TOGGLE_SHORTCUTS_ID).setChecked(false);
549+
}
550+
});
541551
});
542552
});

src/language/CodeInspection.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,14 @@ define(function (require, exports, module) {
13651365
}
13661366
});
13671367

1368+
// When the panel tab is closed externally (e.g. via the × button),
1369+
// update the collapsed state so the panel doesn't auto-reopen.
1370+
WorkspaceManager.on(WorkspaceManager.EVENT_WORKSPACE_PANEL_HIDDEN, function (event, panelID) {
1371+
if (panelID === "errors") {
1372+
_collapsed = true;
1373+
}
1374+
});
1375+
13681376
// Set initial UI state
13691377
toggleEnabled(prefs.get(PREF_ENABLED), true);
13701378
toggleCollapsed(prefs.get(PREF_COLLAPSED), true);

0 commit comments

Comments
 (0)