Move onScroll next to _onScroll

This commit is contained in:
Daniel Imms
2021-04-01 08:54:29 -07:00
parent 1925f1f442
commit f4861aa74a
+12 -13
View File
@@ -71,10 +71,19 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
public get onResize(): IEvent<{ cols: number, rows: number }> { return this._onResize.event; } public get onResize(): IEvent<{ cols: number, rows: number }> { return this._onResize.event; }
protected _onScroll = new EventEmitter<IScrollEvent, void>(); protected _onScroll = new EventEmitter<IScrollEvent, void>();
/** /**
* An emitter for legacy on scroll events that just included the position, and not the source. * Internally we track the source of the scroll but this is meaningless outside the library so
* Used to maintain API consistency for the onScroll method. * it's filtered out.
*/ */
protected _legacyOnScroll?: EventEmitter<number, void>; protected _onScrollApi?: EventEmitter<number, void>;
public get onScroll(): IEvent<number, void> {
if (!this._onScrollApi) {
this._onScrollApi = new EventEmitter<number, void>();
this.register(this._onScroll.event(ev => {
this._onScrollApi?.fire(ev.position);
}));
}
return this._onScrollApi.event;
}
public get cols(): number { return this._bufferService.cols; } public get cols(): number { return this._bufferService.cols; }
public get rows(): number { return this._bufferService.rows; } public get rows(): number { return this._bufferService.rows; }
@@ -287,16 +296,6 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
} }
} }
public get onScroll(): IEvent<number, void> {
if (!this._legacyOnScroll) {
this._legacyOnScroll = new EventEmitter<number, void>();
this.register(this._onScroll.event(ev => {
this._legacyOnScroll?.fire(ev.position);
}));
}
return this._legacyOnScroll.event;
}
/** Add handler for ESC escape sequence. See xterm.d.ts for details. */ /** Add handler for ESC escape sequence. See xterm.d.ts for details. */
public registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable { public registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable {
return this._inputHandler.registerEscHandler(id, callback); return this._inputHandler.registerEscHandler(id, callback);