未验证 提交 08ec1600 编写于 作者: D Daniel Imms 提交者: GitHub

Merge pull request #38287 from martellaj/joem/issue-36271

Adds "copy on select" feature (with setting)
......@@ -120,6 +120,11 @@ configurationRegistry.registerConfiguration({
'type': 'boolean',
'default': TERMINAL_DEFAULT_RIGHT_CLICK_COPY_PASTE
},
'terminal.integrated.copyOnSelection': {
'description': nls.localize('terminal.integrated.copyOnSelection', "When set, text selected in the terminal will be copied to the clipboard."),
'type': 'boolean',
'default': false
},
'terminal.integrated.fontFamily': {
'description': nls.localize('terminal.integrated.fontFamily', "Controls the font family of the terminal, this defaults to editor.fontFamily's value."),
'type': 'string'
......
......@@ -222,6 +222,20 @@ export class TerminalPanel extends Panel {
}
}
}));
this._register(dom.addDisposableListener(this._parentDomElement, 'mouseup', (event: MouseEvent) => {
if (this._configurationService.getValue('terminal.integrated.copyOnSelection')) {
if (this._terminalService.terminalInstances.length === 0) {
return;
}
if (event.which === 1) {
let terminal = this._terminalService.getActiveInstance();
if (terminal.hasSelection()) {
terminal.copySelection();
}
}
}
}));
this._register(dom.addDisposableListener(this._parentDomElement, 'contextmenu', (event: MouseEvent) => {
if (!this._cancelContextMenu) {
const standardEvent = new StandardMouseEvent(event);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册