未验证 提交 d71e5718 编写于 作者: A Alex Ross

Fix ctrl+click to open link in ports view

Fixes #125076
上级 3d2309d4
......@@ -813,28 +813,22 @@ export class TunnelPanel extends ViewPane {
rerender();
}));
this._register(this.table.onMouseClick(e => {
if (this.hasOpenLinkModifier(e.browserEvent)) {
const selection = this.table.getSelectedElements();
if ((selection.length === 0) ||
((selection.length === 1) && (selection[0] === e.element))) {
this.commandService.executeCommand(OpenPortInBrowserAction.ID, e.element);
}
}
}));
this._register(this.table.onDidOpen(e => {
if (!e.element || (e.element.tunnelType !== TunnelType.Forwarded)) {
return;
}
if (e.browserEvent?.type === 'dblclick') {
this.commandService.executeCommand(LabelTunnelAction.ID);
} else if (e.browserEvent instanceof MouseEvent) {
const editorConf = this.configurationService.getValue<{ multiCursorModifier: 'ctrlCmd' | 'alt' }>('editor');
let modifierKey = false;
if (editorConf.multiCursorModifier === 'ctrlCmd') {
modifierKey = e.browserEvent.altKey;
} else {
if (isMacintosh) {
modifierKey = e.browserEvent.metaKey;
} else {
modifierKey = e.browserEvent.ctrlKey;
}
}
if (modifierKey) {
this.commandService.executeCommand(OpenPortInBrowserAction.ID, e.element);
}
}
}));
......@@ -895,6 +889,22 @@ export class TunnelPanel extends ViewPane {
}
}
private hasOpenLinkModifier(e: MouseEvent): boolean {
const editorConf = this.configurationService.getValue<{ multiCursorModifier: 'ctrlCmd' | 'alt' }>('editor');
let modifierKey = false;
if (editorConf.multiCursorModifier === 'ctrlCmd') {
modifierKey = e.altKey;
} else {
if (isMacintosh) {
modifierKey = e.metaKey;
} else {
modifierKey = e.ctrlKey;
}
}
return modifierKey;
}
private onSelectionChanged(event: ITableEvent<ITunnelItem>) {
const elements = event.elements;
if (elements.length > 1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册