diff --git a/src/Terminal.ts b/src/Terminal.ts index 8446ee43..c53e7c98 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -850,11 +850,13 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp // apply global changes on events this.mouseEvents = events; if (events) { - this._logService.info('Binding to mouse events:', events); + if (this.optionsService.options.logLevel === 'debug') { + this._logService.debug('Binding to mouse events:', this._coreMouseService.explainEvents(events)); + } this.element.classList.add('enable-mouse-events'); this._selectionService.disable(); } else { - this._logService.info('Unbinding from mouse events.'); + this._logService.debug('Unbinding from mouse events.'); this.element.classList.remove('enable-mouse-events'); this._selectionService.enable(); } diff --git a/src/common/TestUtils.test.ts b/src/common/TestUtils.test.ts index 62b5402d..f2721bbe 100644 --- a/src/common/TestUtils.test.ts +++ b/src/common/TestUtils.test.ts @@ -37,6 +37,9 @@ export class MockCoreMouseService implements ICoreMouseService { reset(): void {} triggerMouseEvent(event: ICoreMouseEvent): boolean { return false; } onProtocolChange: IEvent = new EventEmitter().event; + explainEvents(events: CoreMouseEventType): {[event: string]: boolean} { + throw new Error('Method not implemented.'); + } } export class MockCoreService implements ICoreService { diff --git a/src/common/services/CoreMouseService.ts b/src/common/services/CoreMouseService.ts index 957537e4..0c846519 100644 --- a/src/common/services/CoreMouseService.ts +++ b/src/common/services/CoreMouseService.ts @@ -292,6 +292,16 @@ export class CoreMouseService implements ICoreMouseService { return true; } + public explainEvents(events: CoreMouseEventType): {[event: string]: boolean} { + return { + DOWN: !!(events & CoreMouseEventType.DOWN), + UP: !!(events & CoreMouseEventType.UP), + DRAG: !!(events & CoreMouseEventType.DRAG), + MOVE: !!(events & CoreMouseEventType.MOVE), + WHEEL: !!(events & CoreMouseEventType.WHEEL) + }; + } + private _compareEvents(e1: ICoreMouseEvent, e2: ICoreMouseEvent): boolean { if (e1.col !== e2.col) return false; if (e1.row !== e2.row) return false; diff --git a/src/common/services/Services.ts b/src/common/services/Services.ts index 61414656..568eeaff 100644 --- a/src/common/services/Services.ts +++ b/src/common/services/Services.ts @@ -47,6 +47,11 @@ export interface ICoreMouseService { * Event to announce changes in mouse tracking. */ onProtocolChange: IEvent; + + /** + * Human readable version of mouse events. + */ + explainEvents(events: CoreMouseEventType): {[event: string]: boolean}; } export const ICoreService = createDecorator('CoreService');