mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Register forwardEvent calls
This commit is contained in:
+9
-9
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user