only report on loglevel debug, explain events

This commit is contained in:
Jörg Breitbart
2019-08-17 13:30:54 +02:00
parent ae914c17d8
commit 82d1bd86da
4 changed files with 22 additions and 2 deletions
+4 -2
View File
@@ -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();
}
+3
View File
@@ -37,6 +37,9 @@ export class MockCoreMouseService implements ICoreMouseService {
reset(): void {}
triggerMouseEvent(event: ICoreMouseEvent): boolean { return false; }
onProtocolChange: IEvent<CoreMouseEventType> = new EventEmitter<CoreMouseEventType>().event;
explainEvents(events: CoreMouseEventType): {[event: string]: boolean} {
throw new Error('Method not implemented.');
}
}
export class MockCoreService implements ICoreService {
+10
View File
@@ -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;
+5
View File
@@ -47,6 +47,11 @@ export interface ICoreMouseService {
* Event to announce changes in mouse tracking.
*/
onProtocolChange: IEvent<CoreMouseEventType>;
/**
* Human readable version of mouse events.
*/
explainEvents(events: CoreMouseEventType): {[event: string]: boolean};
}
export const ICoreService = createDecorator<ICoreService>('CoreService');