From d788ba73bb526992cdc562eeb65daff1ea6ff3fe Mon Sep 17 00:00:00 2001 From: Neil Orans Date: Tue, 29 Jan 2019 23:07:34 -0500 Subject: [PATCH] Fixed bug with array traversal logic in save-all-text fn This logic won't be necessary in Hyper v3 once they get the newest xterm.js. BufferLine instances will have the new translateToString function. --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 7abd20f..1bc6145 100644 --- a/index.js +++ b/index.js @@ -203,9 +203,9 @@ exports.decorateTerm = (Term, { React, notify }) => { let char_array; let line = ''; let non_whitespace_found = false; - for (char_array = term.term._core.buffer.lines._array[line_num].length; char_array >= 0; char_array -= 3) { + for (char_array = term.term._core.buffer.lines._array[line_num].length*3-2; char_array >= 0; char_array -= 3) { let char = String.fromCharCode(term.term._core.buffer.lines._array[line_num]._data[char_array]); - if ((non_whitespace_found && char == ' ') || (non_whitespace_found && char != ' ')) { + if (non_whitespace_found) { line = char + line; // first index is actual char } else if (!non_whitespace_found && char == ' ') { continue;