From 35a12c9483c6b7b6abb79364540355c6d3040cde Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 2 May 2017 10:30:52 +0200 Subject: [PATCH] Closing a tab using middle mouse button on the 'x' causes the tab to the right to also be clsosed (fixes #25529) --- src/vs/workbench/browser/parts/editor/tabsTitleControl.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts index 723495d1b7f..91f679da711 100644 --- a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts @@ -521,7 +521,7 @@ export class TabsTitleControl extends TitleControl { tab.blur(); const { editor, position } = this.toTabContext(index); - if (e.button === 0 /* Left Button */ && !DOM.findParentWithClass((e.target || e.srcElement) as HTMLElement, 'monaco-action-bar', 'tab')) { + if (e.button === 0 /* Left Button */ && !this.isTabActionBar((e.target || e.srcElement) as HTMLElement)) { setTimeout(() => this.editorService.openEditor(editor, null, position).done(null, errors.onUnexpectedError)); // timeout to keep focus in editor after mouse up } })); @@ -531,7 +531,7 @@ export class TabsTitleControl extends TitleControl { DOM.EventHelper.stop(e); tab.blur(); - if (e.button === 1 /* Middle Button */) { + if (e.button === 1 /* Middle Button*/ && !this.isTabActionBar((e.target || e.srcElement) as HTMLElement)) { this.closeEditorAction.run(this.toTabContext(index)).done(null, errors.onUnexpectedError); } })); @@ -666,6 +666,10 @@ export class TabsTitleControl extends TitleControl { return combinedDisposable(disposables); } + private isTabActionBar(element: HTMLElement): boolean { + return !!DOM.findParentWithClass(element, 'monaco-action-bar', 'tab'); + } + private toTabContext(index: number): { group: IEditorGroup, position: Position, editor: IEditorInput } { const group = this.context; const position = this.stacks.positionOfGroup(group); -- GitLab