mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
only report on loglevel debug, explain events
This commit is contained in:
+4
-2
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user