From 86663ea9dc5b4213e2af8429f8a184c59bed7969 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/plugin-bash-like/src/pty/copy.ts b/plugins/plugin-bash-like/src/pty/copy.ts index 056d0d60c0f..b104ef9c319 100644 --- a/plugins/plugin-bash-like/src/pty/copy.ts +++ b/plugins/plugin-bash-like/src/pty/copy.ts @@ -117,8 +117,8 @@ export default function copy(terminal: Terminal): XtermResponse['rows'] { const nLines = lastFullLineIdx(terminal, current) + 1 let prevRow: XtermResponseCell[] - for (let idx = 0; idx < nLines; idx++) { - const line = terminal.buffer.active.getLine(idx) + for (let ridx = 0; ridx < nLines; ridx++) { + const line = terminal.buffer.active.getLine(ridx) if (line.isWrapped && prevRow !== undefined) { squashRow(line, previous, current, prevRow)