(options?: ISerializeOptions)
| 509 | } |
| 510 | |
| 511 | public serialize(options?: ISerializeOptions): string { |
| 512 | // TODO: Add combinedData support |
| 513 | if (!this._terminal) { |
| 514 | throw new Error('Cannot use addon until it has been loaded'); |
| 515 | } |
| 516 | |
| 517 | // Normal buffer |
| 518 | let content = options?.range |
| 519 | ? this._serializeBufferByRange(this._terminal, this._terminal.buffer.normal, options.range, true) |
| 520 | : this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.normal, options?.scrollback); |
| 521 | |
| 522 | // Alternate buffer |
| 523 | if (!options?.excludeAltBuffer) { |
| 524 | if (this._terminal.buffer.active.type === 'alternate') { |
| 525 | const alternativeScreenContent = this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.alternate, undefined); |
| 526 | content += `\u001b[?1049h\u001b[H${alternativeScreenContent}`; |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | // Modes |
| 531 | if (!options?.excludeModes) { |
| 532 | content += this._serializeModes(this._terminal); |
| 533 | } |
| 534 | |
| 535 | return content; |
| 536 | } |
| 537 | |
| 538 | public serializeAsHTML(options?: Partial<IHTMLSerializeOptions>): string { |
| 539 | if (!this._terminal) { |
no test coverage detected