From 796f4d7b1f6b8e858ed0ea767a3cf8d038dd6f1f Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 24 Dec 2017 20:27:42 -0800 Subject: [PATCH] Improve some comments, fix merge --- .../terminal/electron-browser/terminalInstance.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts index 317e04be701..04febdfbe70 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts @@ -332,18 +332,15 @@ export class TerminalInstance implements ITerminalInstance { return undefined; }); this._instanceDisposables.push(dom.addDisposableListener(this._xterm.element, 'mousedown', (event: KeyboardEvent) => { - // We need to listen to the mouseup event up to the document since the user may release the mouse button anywhere - // outside of _xterm.element. + // We need to listen to the mouseup event on the document since the user may release + // the mouse button anywhere outside of _xterm.element. const listener = dom.addDisposableListener(document, 'mouseup', (event: KeyboardEvent) => { + // Delay with a setTimeout to allow the mouseup to propagate through the DOM + // before evaluating the new selection state. setTimeout(() => this._refreshSelectionContextKey(), 0); listener.dispose(); }); })); - this._instanceDisposables.push(dom.addDisposableListener(this._xterm.element, 'mouseup', (event: KeyboardEvent) => { - // Wait until mouseup has propagated through the DOM before - // evaluating the new selection state. - setTimeout(() => this._refreshSelectionContextKey(), 0); - })); // xterm.js currently drops selection on keyup as we need to handle this case. this._instanceDisposables.push(dom.addDisposableListener(this._xterm.element, 'keyup', (event: KeyboardEvent) => { -- GitLab