Skip to content

Commit eafe068

Browse files
committed
fix: quick access option gets stuck in selected state
1 parent c3d9f1c commit eafe068

5 files changed

Lines changed: 67 additions & 3 deletions

File tree

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,6 +1510,21 @@ define(function (require, exports) {
15101510
CommandManager.get(Constants.CMD_GIT_TOGGLE_PANEL).setChecked(false);
15111511
Preferences.set("panelEnabled", false);
15121512
}
1513+
// When the bottom panel container is collapsed, deselect the icon
1514+
// but don't save preference — the panel is still logically open.
1515+
if (panelID === WorkspaceManager.DEFAULT_PANEL_ID && Main.$icon) {
1516+
Main.$icon.toggleClass("on", false);
1517+
Main.$icon.toggleClass("selected-button", false);
1518+
}
1519+
});
1520+
1521+
// When any bottom panel is shown (container is visible),
1522+
// re-select the git icon if git panel is still open.
1523+
WorkspaceManager.on(WorkspaceManager.EVENT_WORKSPACE_PANEL_SHOWN, function (event, panelID) {
1524+
if (Main.$icon && Preferences.get("panelEnabled")) {
1525+
Main.$icon.toggleClass("on", true);
1526+
Main.$icon.toggleClass("selected-button", true);
1527+
}
15131528
});
15141529

15151530
exports.init = init;

src/extensionsIntegrated/CustomSnippets/main.js

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

258+
// Track whether the snippets panel has an open tab (survives container collapse).
259+
let _snippetsTabOpen = false;
260+
258261
// When the panel tab is closed externally (e.g. via the × button),
259262
// update the menu checked state to stay in sync.
260263
WorkspaceManager.on(WorkspaceManager.EVENT_WORKSPACE_PANEL_HIDDEN, function (event, panelID) {
261264
if (panelID === PANEL_ID && customSnippetsPanel) {
265+
_snippetsTabOpen = false;
266+
CommandManager.get(MY_COMMAND_ID).setChecked(false);
267+
}
268+
// Container collapsed — uncheck menu item but keep tab-open flag
269+
if (panelID === WorkspaceManager.DEFAULT_PANEL_ID) {
262270
CommandManager.get(MY_COMMAND_ID).setChecked(false);
263271
}
264272
});
265273

274+
// When any bottom panel is shown (container is visible),
275+
// re-check menu item if snippets panel still has an open tab.
276+
WorkspaceManager.on(WorkspaceManager.EVENT_WORKSPACE_PANEL_SHOWN, function (event, panelID) {
277+
if (panelID === PANEL_ID) {
278+
_snippetsTabOpen = true;
279+
}
280+
if (_snippetsTabOpen) {
281+
CommandManager.get(MY_COMMAND_ID).setChecked(true);
282+
}
283+
});
284+
266285
AppInit.appReady(function () {
267286
CommandManager.register(MENU_ITEM_NAME, MY_COMMAND_ID, showCustomSnippetsPanel);
268287
// Render template with localized strings

src/extensionsIntegrated/DisplayShortcuts/main.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,14 +539,33 @@ define(function (require, exports, module) {
539539
KeyBindingManager.on(KeyBindingManager.EVENT_NEW_PRESET, _updatePresets);
540540
KeyBindingManager.on(KeyBindingManager.EVENT_PRESET_CHANGED, _updatePresets);
541541

542+
// Track whether the shortcuts panel has an open tab (survives container collapse).
543+
let _shortcutsTabOpen = false;
544+
542545
// When the panel tab is closed externally (e.g. via the × button),
543546
// update the menu checked state and clean up resources.
544547
WorkspaceManager.on(WorkspaceManager.EVENT_WORKSPACE_PANEL_HIDDEN, function (event, panelID) {
545548
if (panelID === TOGGLE_SHORTCUTS_ID && panel) {
549+
_shortcutsTabOpen = false;
546550
destroyKeyList();
547551
_clearSortingEventHandlers();
548552
CommandManager.get(TOGGLE_SHORTCUTS_ID).setChecked(false);
549553
}
554+
// Container collapsed — uncheck menu item but keep tab-open flag
555+
if (panelID === WorkspaceManager.DEFAULT_PANEL_ID) {
556+
CommandManager.get(TOGGLE_SHORTCUTS_ID).setChecked(false);
557+
}
558+
});
559+
560+
// When any bottom panel is shown (container is visible),
561+
// re-check menu item if shortcuts panel still has an open tab.
562+
WorkspaceManager.on(WorkspaceManager.EVENT_WORKSPACE_PANEL_SHOWN, function (event, panelID) {
563+
if (panelID === TOGGLE_SHORTCUTS_ID) {
564+
_shortcutsTabOpen = true;
565+
}
566+
if (_shortcutsTabOpen) {
567+
CommandManager.get(TOGGLE_SHORTCUTS_ID).setChecked(true);
568+
}
550569
});
551570
});
552571
});

src/view/DefaultPanelView.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,13 @@ define(function (require, exports, module) {
198198
}
199199
});
200200

201-
// Update drawer button state when panels are shown.
201+
// Update drawer button state based on bottom panel container visibility.
202+
// The app drawer icon stays selected whenever the bottom panel is visible.
202203
PanelView.on(PanelView.EVENT_PANEL_SHOWN, function (event, panelID) {
203204
if (panelID === WorkspaceManager.DEFAULT_PANEL_ID) {
204205
_updateButtonVisibility();
205206
}
206-
$drawerBtn.toggleClass("selected-button", panelID === WorkspaceManager.DEFAULT_PANEL_ID);
207+
$drawerBtn.addClass("selected-button");
207208
});
208209

209210
PanelView.on(PanelView.EVENT_PANEL_HIDDEN, function (event, panelID) {

src/view/PanelView.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,8 +899,18 @@ define(function (require, exports, module) {
899899
// Maximize state is preserved so the panel re-opens maximized.
900900
_$tabBar.on("click", ".bottom-panel-hide-btn", function (e) {
901901
e.stopPropagation();
902-
if (_$container.is(":visible")) {
902+
if (_$container && _$container.is(":visible")) {
903+
if (_activeId) {
904+
const activePanel = _panelMap[_activeId];
905+
if (activePanel) {
906+
activePanel.$panel.removeClass("active-bottom-panel");
907+
}
908+
}
909+
_activeId = null;
910+
_updateActiveTabHighlight();
911+
restoreIfMaximized();
903912
Resizer.hide(_$container[0]);
913+
exports.trigger(EVENT_PANEL_HIDDEN, _defaultPanelId);
904914
}
905915
});
906916

0 commit comments

Comments
 (0)