mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-23 15:17:59 +01:00
editor: hide orphan layout action separator
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot
parent
893e1972b3
commit
cf817b16fc
@@ -126,6 +126,7 @@ export abstract class EditorTabsControl extends Themable implements IEditorTabsC
|
||||
protected editorLayoutActionsSeparator: HTMLElement | undefined;
|
||||
protected editorLayoutActionsToolbarContainer: HTMLElement | undefined;
|
||||
private editorLayoutActionsToolbar: WorkbenchToolBar | undefined;
|
||||
private editorLayoutActionsToolbarHasActions = false;
|
||||
private readonly editorLayoutActionsToolbarDisposables = this._register(new DisposableStore());
|
||||
private readonly editorLayoutActionsDisposables = this._register(new DisposableStore());
|
||||
|
||||
@@ -257,9 +258,8 @@ export abstract class EditorTabsControl extends Themable implements IEditorTabsC
|
||||
}
|
||||
|
||||
private updateEditorLayoutActionsSeparator(): void {
|
||||
const hasLayoutActions = (this.editorLayoutActionsToolbar?.getItemsLength() ?? 0) > 0;
|
||||
if (this.editorLayoutActionsSeparator) {
|
||||
setVisibility(hasLayoutActions
|
||||
setVisibility(this.editorLayoutActionsToolbarHasActions
|
||||
&& !this.editorActionsToolbarHasTrailingSeparator
|
||||
&& !this.addTabControlHasTrailingSeparator
|
||||
&& (this.editorActionsToolbarHasActions || this.addTabControlHasActions), this.editorLayoutActionsSeparator);
|
||||
@@ -297,6 +297,7 @@ export abstract class EditorTabsControl extends Themable implements IEditorTabsC
|
||||
else if (!editorActionsEnabled && editorActionsVisible) {
|
||||
this.editorLayoutActionsToolbar?.getElement().remove();
|
||||
this.editorLayoutActionsToolbar = undefined;
|
||||
this.editorLayoutActionsToolbarHasActions = false;
|
||||
this.editorLayoutActionsToolbarDisposables.clear();
|
||||
this.editorLayoutActionsDisposables.clear();
|
||||
}
|
||||
@@ -428,6 +429,7 @@ export abstract class EditorTabsControl extends Themable implements IEditorTabsC
|
||||
this.editorLayoutActionsToolbar.setActions(prepareActions(primary), prepareActions(secondary));
|
||||
|
||||
const hasLayoutActions = primary.length > 0 || secondary.length > 0;
|
||||
this.editorLayoutActionsToolbarHasActions = hasLayoutActions;
|
||||
|
||||
// Only show the separator and the toolbar container when the layout toolbar
|
||||
// has actions AND there are editor actions to its left to separate from.
|
||||
@@ -454,6 +456,7 @@ export abstract class EditorTabsControl extends Themable implements IEditorTabsC
|
||||
this.editorActionsToolbarHasActions = false;
|
||||
|
||||
this.editorLayoutActionsToolbar?.setActions([], []);
|
||||
this.editorLayoutActionsToolbarHasActions = false;
|
||||
if (this.editorLayoutActionsSeparator) {
|
||||
setVisibility(false, this.editorLayoutActionsSeparator);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user