From 9046680f5a03234b395c500354cfad005adbefa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Javier=20Merino=20Mor=C3=A1n?= Date: Mon, 23 May 2022 10:28:13 +0200 Subject: [PATCH] Ignore non-real chars for selection in history Commit e8f77101 did this for screen lines. Do it also for lines in the history buffer. --- src/Screen.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Screen.cpp b/src/Screen.cpp index 1377885f..3f9388ae 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -1636,6 +1636,12 @@ int Screen::copyLineToStream(int line, _history->getCells(line, start, count, characterBuffer); + // Exclude trailing empty cells from count and don't bother processing them further. + // See the comment on the similar case for screen lines for an explanation. + while (count > 0 && !characterBuffer[start + count - 1].isRealCharacter) { + count--; + } + if (_history->isWrappedLine(line)) { currentLineProperties |= LINE_WRAPPED; } else {