From 9969c034587b131555bb116f41f062fde791b2a8 Mon Sep 17 00:00:00 2001 From: Nick Mitchell Date: Fri, 17 Jun 2022 13:50:58 -0400 Subject: [PATCH] fix: xterm copy-out logic is erratic with line wrapping when capturing the output of the pty, line wrapping causes odd behavior, with lines squashed together strangely --- plugins/plugin-bash-like/src/pty/copy.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/plugin-bash-like/src/pty/copy.ts b/plugins/plugin-bash-like/src/pty/copy.ts index 056d0d60c0f..1d3ef2913c8 100644 --- a/plugins/plugin-bash-like/src/pty/copy.ts +++ b/plugins/plugin-bash-like/src/pty/copy.ts @@ -116,9 +116,9 @@ export default function copy(terminal: Terminal): XtermResponse['rows'] { const current = terminal.buffer.active.getNullCell() const nLines = lastFullLineIdx(terminal, current) + 1 - let prevRow: XtermResponseCell[] - for (let idx = 0; idx < nLines; idx++) { - const line = terminal.buffer.active.getLine(idx) + let prevRow: XtermResponseCell[] = undefined // eslint-disable-line + for (let ridx = 0; ridx < nLines; ridx++) { + const line = terminal.buffer.active.getLine(ridx) if (line.isWrapped && prevRow !== undefined) { squashRow(line, previous, current, prevRow)