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)