| 116 | * each function's header comment. |
| 117 | */ |
| 118 | export class InputHandler extends Disposable implements IInputHandler { |
| 119 | private _parseBuffer: Uint32Array = new Uint32Array(4096); |
| 120 | private _stringDecoder: StringToUtf32 = new StringToUtf32(); |
| 121 | private _utf8Decoder: Utf8ToUtf32 = new Utf8ToUtf32(); |
| 122 | private _windowTitle = ''; |
| 123 | private _iconName = ''; |
| 124 | private _dirtyRowTracker: IDirtyRowTracker; |
| 125 | protected _windowTitleStack: string[] = []; |
| 126 | protected _iconNameStack: string[] = []; |
| 127 | |
| 128 | private _curAttrData: IAttributeData = DEFAULT_ATTR_DATA.clone(); |
| 129 | public getAttrData(): IAttributeData { return this._curAttrData; } |
| 130 | private _eraseAttrDataInternal: IAttributeData = DEFAULT_ATTR_DATA.clone(); |
| 131 | |
| 132 | private _activeBuffer: IBuffer; |
| 133 | |
| 134 | private readonly _onRequestBell = this._register(new Emitter<void>()); |
| 135 | public readonly onRequestBell = this._onRequestBell.event; |
| 136 | private readonly _onRequestRefreshRows = this._register(new Emitter<{ start: number, end: number } | undefined>()); |
| 137 | public readonly onRequestRefreshRows = this._onRequestRefreshRows.event; |
| 138 | private readonly _onRequestReset = this._register(new Emitter<void>()); |
| 139 | public readonly onRequestReset = this._onRequestReset.event; |
| 140 | private readonly _onRequestSendFocus = this._register(new Emitter<void>()); |
| 141 | public readonly onRequestSendFocus = this._onRequestSendFocus.event; |
| 142 | private readonly _onRequestSyncScrollBar = this._register(new Emitter<void>()); |
| 143 | public readonly onRequestSyncScrollBar = this._onRequestSyncScrollBar.event; |
| 144 | private readonly _onRequestWindowsOptionsReport = this._register(new Emitter<WindowsOptionsReportType>()); |
| 145 | public readonly onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event; |
| 146 | |
| 147 | private readonly _onA11yChar = this._register(new Emitter<string>()); |
| 148 | public readonly onA11yChar = this._onA11yChar.event; |
| 149 | private readonly _onA11yTab = this._register(new Emitter<number>()); |
| 150 | public readonly onA11yTab = this._onA11yTab.event; |
| 151 | private readonly _onCursorMove = this._register(new Emitter<void>()); |
| 152 | public readonly onCursorMove = this._onCursorMove.event; |
| 153 | private readonly _onLineFeed = this._register(new Emitter<void>()); |
| 154 | public readonly onLineFeed = this._onLineFeed.event; |
| 155 | private readonly _onScroll = this._register(new Emitter<number>()); |
| 156 | public readonly onScroll = this._onScroll.event; |
| 157 | private readonly _onTitleChange = this._register(new Emitter<string>()); |
| 158 | public readonly onTitleChange = this._onTitleChange.event; |
| 159 | private readonly _onColor = this._register(new Emitter<IColorEvent>()); |
| 160 | public readonly onColor = this._onColor.event; |
| 161 | |
| 162 | private _parseStack: IParseStack = { |
| 163 | paused: false, |
| 164 | cursorStartX: 0, |
| 165 | cursorStartY: 0, |
| 166 | decodedLength: 0, |
| 167 | position: 0 |
| 168 | }; |
| 169 | |
| 170 | constructor( |
| 171 | private readonly _bufferService: IBufferService, |
| 172 | private readonly _charsetService: ICharsetService, |
| 173 | private readonly _coreService: ICoreService, |
| 174 | private readonly _logService: ILogService, |
| 175 | private readonly _optionsService: IOptionsService, |