From 63fd3be67acc74048a29369c770cda867ceefa01 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 12 Aug 2019 17:56:26 -0700 Subject: [PATCH] Ensure selection service mousedown happens after mouse zone manager Fixes #2380 --- src/Terminal.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Terminal.ts b/src/Terminal.ts index ef05c664..07150aad 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -643,7 +643,6 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp this.screenElement); this._instantiationService.setService(ISelectionService, this._selectionService); this.register(this._selectionService.onSelectionChange(() => this._onSelectionChange.fire())); - this.register(addDisposableDomListener(this.element, 'mousedown', (e: MouseEvent) => this._selectionService.onMouseDown(e))); this.register(this._selectionService.onRedrawRequest(e => this._renderService.onSelectionChanged(e.start, e.end, e.columnSelectMode))); this.register(this._selectionService.onLinuxMouseSelection(text => { // If there's a new selection, put it into the textarea, focus and select it @@ -664,6 +663,9 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp this.register(this.onScroll(() => this._mouseZoneManager.clearAll())); this.linkifier.attachToDom(this.element, this._mouseZoneManager); + // This event listener must be registered aftre MouseZoneManager is created + this.register(addDisposableDomListener(this.element, 'mousedown', (e: MouseEvent) => this._selectionService.onMouseDown(e))); + // apply mouse event classes set by escape codes before terminal was attached if (this.mouseEvents) { this._selectionService.disable();