| 409 | } |
| 410 | |
| 411 | protected _nextCell(cell: IBufferCell, _oldCell: IBufferCell, row: number, col: number): void { |
| 412 | const isPlaceHolderCell = cell.getWidth() === 0 |
| 413 | |
| 414 | if (isPlaceHolderCell) { |
| 415 | return |
| 416 | } |
| 417 | |
| 418 | const codepoint = cell.getCode() |
| 419 | const isInvalidCodepoint = codepoint > 0x10ffff || (codepoint >= 0xd800 && codepoint <= 0xdfff) |
| 420 | const isGarbage = isInvalidCodepoint || (codepoint >= 0xf000 && cell.getWidth() === 1) |
| 421 | const isEmptyCell = codepoint === 0 || cell.getChars() === "" || isGarbage |
| 422 | |
| 423 | const sgrSeq = this._diffStyle(cell, this._cursorStyle) |
| 424 | |
| 425 | const styleChanged = sgrSeq.length > 0 |
| 426 | |
| 427 | if (styleChanged) { |
| 428 | if (this._nullCellCount > 0) { |
| 429 | this._currentRow += " ".repeat(this._nullCellCount) |
| 430 | this._nullCellCount = 0 |
| 431 | } |
| 432 | |
| 433 | this._lastContentCursorRow = this._lastCursorRow = row |
| 434 | this._lastContentCursorCol = this._lastCursorCol = col |
| 435 | |
| 436 | this._currentRow += `\u001b[${sgrSeq.join(";")}m` |
| 437 | |
| 438 | const line = this._buffer.getLine(row) |
| 439 | const cellFromLine = line?.getCell(col) |
| 440 | if (cellFromLine) { |
| 441 | this._cursorStyle = cellFromLine |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | if (isEmptyCell) { |
| 446 | this._nullCellCount += cell.getWidth() |
| 447 | } else { |
| 448 | if (this._nullCellCount > 0) { |
| 449 | this._currentRow += " ".repeat(this._nullCellCount) |
| 450 | this._nullCellCount = 0 |
| 451 | } |
| 452 | |
| 453 | this._currentRow += cell.getChars() |
| 454 | |
| 455 | this._lastContentCursorRow = this._lastCursorRow = row |
| 456 | this._lastContentCursorCol = this._lastCursorCol = col + cell.getWidth() |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | protected _serializeString(excludeFinalCursorPosition?: boolean): string { |
| 461 | let rowEnd = this._allRows.length |