提交 35a12c94 编写于 作者: B Benjamin Pasero

Closing a tab using middle mouse button on the 'x' causes the tab to the right...

Closing a tab using middle mouse button on the 'x' causes the tab to the right to also be clsosed (fixes #25529)
上级 3735a360
...@@ -521,7 +521,7 @@ export class TabsTitleControl extends TitleControl { ...@@ -521,7 +521,7 @@ export class TabsTitleControl extends TitleControl {
tab.blur(); tab.blur();
const { editor, position } = this.toTabContext(index); 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 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 { ...@@ -531,7 +531,7 @@ export class TabsTitleControl extends TitleControl {
DOM.EventHelper.stop(e); DOM.EventHelper.stop(e);
tab.blur(); 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); this.closeEditorAction.run(this.toTabContext(index)).done(null, errors.onUnexpectedError);
} }
})); }));
...@@ -666,6 +666,10 @@ export class TabsTitleControl extends TitleControl { ...@@ -666,6 +666,10 @@ export class TabsTitleControl extends TitleControl {
return combinedDisposable(disposables); 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 } { private toTabContext(index: number): { group: IEditorGroup, position: Position, editor: IEditorInput } {
const group = this.context; const group = this.context;
const position = this.stacks.positionOfGroup(group); const position = this.stacks.positionOfGroup(group);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册