mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-13 21:47:12 -05:00
Merge pull request #38287 from martellaj/joem/issue-36271
Adds "copy on select" feature (with setting)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user