Fix terminal.integrated.rightClickCopyPaste on macOS

Fixes #25844
This commit is contained in:
Daniel Imms 2017-05-05 10:11:39 -07:00
parent 69aaa885e2
commit cf03392bf3
2 changed files with 10 additions and 1 deletions

View file

@ -320,7 +320,7 @@ export class TerminalInstance implements ITerminalInstance {
}
public clearSelection(): void {
document.getSelection().empty();
window.getSelection().empty();
}
public dispose(): void {

View file

@ -172,6 +172,15 @@ export class TerminalPanel extends Panel {
} else {
terminal.paste();
}
// Clear selection after all click event bubbling is finished on Mac to prevent
// right-click selecting a word which is seemed cannot be disabled. There is a
// flicker when pasting but this appears to give the best experience if the
// setting is enabled.
if (platform.isMacintosh) {
setTimeout(() => {
terminal.clearSelection();
}, 0);
}
this._cancelContextMenu = true;
}
}