Skip to content

Commit fb9f024

Browse files
committed
fix: disabled menus should be able to set key shortcut. next and prev doc shortcut
1 parent 3af7489 commit fb9f024

4 files changed

Lines changed: 23 additions & 6 deletions

File tree

src/command/DefaultMenus.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ define(function (require, exports, module) {
7676
const openFileShortcut = isDesktop ? "Ctrl-O" : "";
7777
const openFolderShortcut = isBrowser ? "Ctrl-O" : "";
7878
const reopenClosedShortcut = isBrowser ? "" : "Ctrl-Shift-T";
79+
const nextDocShortcut = isBrowser ? "Alt-PageDown" : "Ctrl-PageDown";
80+
const prevDocShortcut = isBrowser ? "Alt-PageUp" : "Ctrl-PageUp";
7981

8082
AppInit.htmlReady(function () {
8183
/**
@@ -237,8 +239,8 @@ define(function (require, exports, module) {
237239
menu.addMenuDivider();
238240
menu.addMenuItem(Commands.NAVIGATE_NEXT_DOC);
239241
menu.addMenuItem(Commands.NAVIGATE_PREV_DOC);
240-
menu.addMenuItem(Commands.NAVIGATE_NEXT_DOC_LIST_ORDER);
241-
menu.addMenuItem(Commands.NAVIGATE_PREV_DOC_LIST_ORDER);
242+
menu.addMenuItem(Commands.NAVIGATE_NEXT_DOC_LIST_ORDER, nextDocShortcut);
243+
menu.addMenuItem(Commands.NAVIGATE_PREV_DOC_LIST_ORDER, prevDocShortcut);
242244
menu.addMenuDivider();
243245
menu.addMenuItem(Commands.NAVIGATE_SHOW_IN_FILE_TREE);
244246
menu.addMenuDivider();

src/command/Menus.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,9 @@ define(function (require, exports, module) {
651651
$menuItem.on("mouseenter", function () {
652652
// This is to prevent size jumps when the keyboard
653653
// icon hides and shows as selection changes
654+
$menuAnchor.addClass("use-invisible-for-width-compute");
654655
const currentWidth = $(this).width(); // Get the current width
656+
$menuAnchor.removeClass("use-invisible-for-width-compute");
655657
$(this).css('min-width', currentWidth + 'px');
656658
self.closeSubMenu();
657659
// now show selection
@@ -819,10 +821,13 @@ define(function (require, exports, module) {
819821
"<span class='right-pusher'></span>" +
820822
"<span>&rtrif;</span>" +
821823
"</a></li>");
824+
const $menuAnchor = $menuItem.find(".menuAnchor");
822825

823826
let self = this;
824827
$menuItem.on("mouseenter", function(e) {
828+
$menuAnchor.addClass("use-invisible-for-width-compute");
825829
const currentWidth = $(this).width(); // Get the current width
830+
$menuAnchor.removeClass("use-invisible-for-width-compute");
826831
$(this).css('min-width', currentWidth + 'px'); // Set min-width to the current width
827832
if (self.openSubMenu && self.openSubMenu.id === menu.id) {
828833
return;

src/extensionsIntegrated/DisplayShortcuts/vscode.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,10 @@
1313
"Ctrl-B": "view.toggleSidebar",
1414
"Ctrl-J": "view.togglePanels",
1515
"Ctrl-Shift-X": "file.extensionManager",
16-
"Alt-Z": "view.toggleWordWrap"
16+
"Alt-Z": "view.toggleWordWrap",
17+
"Ctrl-Alt--": "navigation.jump.back",
18+
"Ctrl-Shift-_": "navigation.jump.fwd",
19+
"Ctrl-P": "navigate.quickOpen",
20+
"Ctrl-Shift-P": "cmd.keyboardNavUI",
21+
"Ctrl-Shift-O": "navigate.gotoDefinition"
1722
}

src/styles/brackets_patterns_override.less

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,16 +543,21 @@ a:focus {
543543
}
544544
}
545545

546-
.menuAnchor.selected .menu-shortcut:not(.fixed-shortcut) {
546+
.menuAnchor:hover .menu-shortcut:not(.fixed-shortcut) {
547547
display: none;
548548
}
549549

550-
.menuAnchor.selected .keyboard-icon {
550+
.menuAnchor.use-invisible-for-width-compute:hover .menu-shortcut:not(.fixed-shortcut) {
551+
visibility: hidden;
552+
display: unset;
553+
}
554+
555+
.menuAnchor:hover .keyboard-icon {
551556
cursor: pointer;
552557
visibility: visible;
553558
}
554559

555-
.menuAnchor.selected .keyboard-icon:hover {
560+
.menuAnchor:hover .keyboard-icon:hover {
556561
color: @bc-secondary-btn-border;
557562
}
558563

0 commit comments

Comments
 (0)