(data: Uint32Array, start: number, end: number)
| 510 | } |
| 511 | |
| 512 | public print(data: Uint32Array, start: number, end: number): void { |
| 513 | let code: number; |
| 514 | let chWidth: number; |
| 515 | const charset = this._charsetService.charset; |
| 516 | const screenReaderMode = this._optionsService.rawOptions.screenReaderMode; |
| 517 | const cols = this._bufferService.cols; |
| 518 | const wraparoundMode = this._coreService.decPrivateModes.wraparound; |
| 519 | const insertMode = this._coreService.modes.insertMode; |
| 520 | const curAttr = this._curAttrData; |
| 521 | let bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!; |
| 522 | |
| 523 | this._dirtyRowTracker.markDirty(this._activeBuffer.y); |
| 524 | |
| 525 | // handle wide chars: reset start_cell-1 if we would overwrite the second cell of a wide char |
| 526 | if (this._activeBuffer.x && end - start > 0 && bufferRow.getWidth(this._activeBuffer.x - 1) === 2) { |
| 527 | bufferRow.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, curAttr); |
| 528 | } |
| 529 | |
| 530 | let precedingJoinState = this._parser.precedingJoinState; |
| 531 | for (let pos = start; pos < end; ++pos) { |
| 532 | code = data[pos]; |
| 533 | |
| 534 | // get charset replacement character |
| 535 | // charset is only defined for ASCII, therefore we only |
| 536 | // search for an replacement char if code < 127 |
| 537 | if (code < 127 && charset) { |
| 538 | const ch = charset[String.fromCharCode(code)]; |
| 539 | if (ch) { |
| 540 | code = ch.charCodeAt(0); |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | const currentInfo = this._unicodeService.charProperties(code, precedingJoinState); |
| 545 | chWidth = UnicodeService.extractWidth(currentInfo); |
| 546 | const shouldJoin = UnicodeService.extractShouldJoin(currentInfo); |
| 547 | const oldWidth = shouldJoin ? UnicodeService.extractWidth(precedingJoinState) : 0; |
| 548 | precedingJoinState = currentInfo; |
| 549 | |
| 550 | if (screenReaderMode) { |
| 551 | this._onA11yChar.fire(stringFromCodePoint(code)); |
| 552 | } |
| 553 | if (this._getCurrentLinkId()) { |
| 554 | this._oscLinkService.addLineToLink(this._getCurrentLinkId(), this._activeBuffer.ybase + this._activeBuffer.y); |
| 555 | } |
| 556 | |
| 557 | // goto next line if ch would overflow |
| 558 | // NOTE: To avoid costly width checks here, |
| 559 | // the terminal does not allow a cols < 2. |
| 560 | if (this._activeBuffer.x + chWidth - oldWidth > cols) { |
| 561 | // autowrap - DECAWM |
| 562 | // automatically wraps to the beginning of the next line |
| 563 | if (wraparoundMode) { |
| 564 | const oldRow = bufferRow; |
| 565 | let oldCol = this._activeBuffer.x - oldWidth; |
| 566 | this._activeBuffer.x = oldWidth; |
| 567 | this._activeBuffer.y++; |
| 568 | if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) { |
| 569 | this._activeBuffer.y--; |
no test coverage detected