Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/vs/base/browser/ui/menu/menubar.ts')
-rw-r--r--src/vs/base/browser/ui/menu/menubar.ts22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/vs/base/browser/ui/menu/menubar.ts b/src/vs/base/browser/ui/menu/menubar.ts
index 10dd697e7a4..572b33983cc 100644
--- a/src/vs/base/browser/ui/menu/menubar.ts
+++ b/src/vs/base/browser/ui/menu/menubar.ts
@@ -334,8 +334,6 @@ export class MenuBar extends Disposable {
triggerKeys.push(KeyCode.RightArrow);
} else if (this.options.compactMode === Direction.Left) {
triggerKeys.push(KeyCode.LeftArrow);
- } else if (this.options.compactMode === Direction.Down) {
- triggerKeys.push(KeyCode.DownArrow);
}
}
@@ -475,6 +473,11 @@ export class MenuBar extends Disposable {
return;
}
+ const overflowMenuOnlyClass = 'overflow-menu-only';
+
+ // Remove overflow only restriction to allow the most space
+ this.container.classList.toggle(overflowMenuOnlyClass, false);
+
const sizeAvailable = this.container.offsetWidth;
let currentSize = 0;
let full = this.isCompact;
@@ -501,6 +504,18 @@ export class MenuBar extends Disposable {
}
}
+
+ // If below minimium menu threshold, show the overflow menu only as hamburger menu
+ if (this.numMenusShown - 1 <= showableMenus.length / 2) {
+ for (const menuBarMenu of showableMenus) {
+ menuBarMenu.buttonElement.style.visibility = 'hidden';
+ }
+
+ full = true;
+ this.numMenusShown = 0;
+ currentSize = 0;
+ }
+
// Overflow
if (this.isCompact) {
this.overflowMenu.actions = [];
@@ -540,6 +555,9 @@ export class MenuBar extends Disposable {
this.container.appendChild(this.overflowMenu.buttonElement);
this.overflowMenu.buttonElement.style.visibility = 'hidden';
}
+
+ // If we are only showing the overflow, add this class to avoid taking up space
+ this.container.classList.toggle(overflowMenuOnlyClass, this.numMenusShown === 0);
}
private updateLabels(titleElement: HTMLElement, buttonElement: HTMLElement, label: string): void {