Register forwardEvent calls

This commit is contained in:
Daniel Imms
2020-04-26 06:21:16 -07:00
parent a6949d522e
commit 451d9aab96
3 changed files with 15 additions and 15 deletions
+9 -9
View File
@@ -175,15 +175,15 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT
} else {
// Register input handler and refire/handle events
this._inputHandler = new InputHandler(this, this._bufferService, this._charsetService, this._coreService, this._dirtyRowService, this._logService, this.optionsService, this._coreMouseService, this.unicodeService, this._instantiationService);
this._inputHandler.onRequestBell(() => this.bell());
this._inputHandler.onRequestRefreshRows((start, end) => this.refresh(start, end));
this._inputHandler.onRequestReset(() => this.reset());
this._inputHandler.onScrollRequest((eraseAttr, isWrapped) => this.scroll(eraseAttr, isWrapped || undefined));
forwardEvent(this._inputHandler.onCursorMove, this._onCursorMove);
forwardEvent(this._inputHandler.onLineFeed, this._onLineFeed);
forwardEvent(this._inputHandler.onTitleChange, this._onTitleChange);
forwardEvent(this._inputHandler.onA11yChar, this._onA11yCharEmitter);
forwardEvent(this._inputHandler.onA11yTab, this._onA11yTabEmitter);
this.register(this._inputHandler.onRequestBell(() => this.bell()));
this.register(this._inputHandler.onRequestRefreshRows((start, end) => this.refresh(start, end)));
this.register(this._inputHandler.onRequestReset(() => this.reset()));
this.register(this._inputHandler.onScrollRequest((eraseAttr, isWrapped) => this.scroll(eraseAttr, isWrapped || undefined)));
this.register(forwardEvent(this._inputHandler.onCursorMove, this._onCursorMove));
this.register(forwardEvent(this._inputHandler.onLineFeed, this._onLineFeed));
this.register(forwardEvent(this._inputHandler.onTitleChange, this._onTitleChange));
this.register(forwardEvent(this._inputHandler.onA11yChar, this._onA11yCharEmitter));
this.register(forwardEvent(this._inputHandler.onA11yTab, this._onA11yTabEmitter));
this.register(this._inputHandler);
}
+4 -4
View File
@@ -90,10 +90,10 @@ export abstract class CoreTerminal extends Disposable {
this._instantiationService.setService(ICharsetService, this._charsetService);
// Setup listeners
forwardEvent(this._bufferService.onResize, this._onResize);
forwardEvent(this._coreService.onData, this._onData);
forwardEvent(this._coreService.onBinary, this._onBinary);
this.optionsService.onOptionChange(key => this._updateOptions(key));
this.register(forwardEvent(this._bufferService.onResize, this._onResize));
this.register(forwardEvent(this._coreService.onData, this._onData));
this.register(forwardEvent(this._coreService.onBinary, this._onBinary));
this.register(this.optionsService.onOptionChange(key => this._updateOptions(key)));
}
public dispose(): void {
+2 -2
View File
@@ -64,6 +64,6 @@ export class EventEmitter<T, U = void> implements IEventEmitter<T, U> {
}
}
export function forwardEvent<T>(from: IEvent<T>, to: IEventEmitter<T>): void {
from(e => to.fire(e));
export function forwardEvent<T>(from: IEvent<T>, to: IEventEmitter<T>): IDisposable {
return from(e => to.fire(e));
}