mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
🧹
This commit is contained in:
parent
9bc642fa22
commit
a9c444a605
|
@ -38,6 +38,7 @@ import { getColorForSeverity } from 'vs/workbench/contrib/terminal/browser/termi
|
|||
import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { TerminalTabContextMenuGroup } from 'vs/workbench/contrib/terminal/browser/terminalMenus';
|
||||
import { DropdownWithPrimaryActionViewItem } from 'vs/platform/actions/browser/dropdownWithPrimaryActionViewItem';
|
||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export class TerminalViewPane extends ViewPane {
|
||||
private _actions: IAction[] | undefined;
|
||||
|
@ -345,7 +346,7 @@ function getTerminalSelectOpenItems(terminalService: ITerminalService): ISelectO
|
|||
|
||||
class SingleTerminalTabActionViewItem extends ActionViewItem {
|
||||
private _color: string | undefined;
|
||||
private _initializedListener: boolean = false;
|
||||
private _contextMenuListener: IDisposable | undefined;
|
||||
constructor(
|
||||
action: IAction,
|
||||
private readonly _actions: IAction[],
|
||||
|
@ -371,13 +372,16 @@ class SingleTerminalTabActionViewItem extends ActionViewItem {
|
|||
this.updateLabel();
|
||||
}
|
||||
}));
|
||||
this._register(toDisposable(() => this._contextMenuListener?.dispose()));
|
||||
}
|
||||
|
||||
override updateLabel(): void {
|
||||
if (!this._initializedListener) {
|
||||
// makes sure this.element is defined
|
||||
this._initListener();
|
||||
this._initializedListener = true;
|
||||
if (!this._contextMenuListener) {
|
||||
this._contextMenuListener = dom.addDisposableListener(this.element!, dom.EventType.CONTEXT_MENU, (e: MouseEvent) => {
|
||||
if (e.button === 2) {
|
||||
this._run();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (this.label) {
|
||||
const label = this.label;
|
||||
|
@ -417,14 +421,6 @@ class SingleTerminalTabActionViewItem extends ActionViewItem {
|
|||
getActionsContext: () => this.label
|
||||
});
|
||||
}
|
||||
|
||||
private _initListener(): void {
|
||||
this._register(dom.addDisposableListener(this.element!, dom.EventType.CONTEXT_MENU, (e: MouseEvent) => {
|
||||
if (e.button === 2) {
|
||||
this._run();
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
function getSingleTabLabel(instance: ITerminalInstance | null) {
|
||||
|
|
Loading…
Reference in a new issue