mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Merge pull request #3506 from Tyriar/2333_sendfocus
Report focus state on DECSET 1004
This commit is contained in:
@@ -164,6 +164,7 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
||||
// Setup InputHandler listeners
|
||||
this.register(this._inputHandler.onRequestBell(() => this.bell()));
|
||||
this.register(this._inputHandler.onRequestRefreshRows((start, end) => this.refresh(start, end)));
|
||||
this.register(this._inputHandler.onRequestSendFocus(() => this._reportFocus()));
|
||||
this.register(this._inputHandler.onRequestReset(() => this.reset()));
|
||||
this.register(this._inputHandler.onRequestWindowsOptionsReport(type => this._reportWindowsOptions(type)));
|
||||
this.register(this._inputHandler.onAnsiColorChange((event) => this._changeAnsiColor(event)));
|
||||
@@ -1296,6 +1297,14 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
||||
this._renderService?.clearTextureAtlas();
|
||||
}
|
||||
|
||||
private _reportFocus(): void {
|
||||
if (this.element?.classList.contains('focus')) {
|
||||
this.coreService.triggerDataEvent(C0.ESC + '[I');
|
||||
} else {
|
||||
this.coreService.triggerDataEvent(C0.ESC + '[O');
|
||||
}
|
||||
}
|
||||
|
||||
private _reportWindowsOptions(type: WindowsOptionsReportType): void {
|
||||
if (!this._renderService) {
|
||||
return;
|
||||
|
||||
@@ -243,6 +243,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
public get onRequestRefreshRows(): IEvent<number, number> { return this._onRequestRefreshRows.event; }
|
||||
private _onRequestReset = new EventEmitter<void>();
|
||||
public get onRequestReset(): IEvent<void> { return this._onRequestReset.event; }
|
||||
private _onRequestSendFocus = new EventEmitter<void>();
|
||||
public get onRequestSendFocus(): IEvent<void> { return this._onRequestSendFocus.event; }
|
||||
private _onRequestSyncScrollBar = new EventEmitter<void>();
|
||||
public get onRequestSyncScrollBar(): IEvent<void> { return this._onRequestSyncScrollBar.event; }
|
||||
private _onRequestWindowsOptionsReport = new EventEmitter<WindowsOptionsReportType>();
|
||||
@@ -1956,6 +1958,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
// focusin: ^[[I
|
||||
// focusout: ^[[O
|
||||
this._coreService.decPrivateModes.sendFocus = true;
|
||||
this._onRequestSendFocus.fire();
|
||||
break;
|
||||
case 1005: // utf8 ext mode mouse - removed in #2507
|
||||
this._logService.debug('DECSET 1005 not supported (see #2507)');
|
||||
|
||||
Reference in New Issue
Block a user