From 4e0bcd4edbf405988282e8264d51376b3ab45e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Javier=20Merino=20Mor=C3=A1n?= Date: Wed, 18 May 2022 18:00:06 +0200 Subject: [PATCH] Set default rendition before clearing the screen Otherwise, weirdness ensues. e.g. if you do: seq 1 $((LINES)); printf '\e[31m\ec' and try to select the blank lines, the selection shows the previous rendition color. --- src/Screen.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Screen.cpp b/src/Screen.cpp index 27d5504a..f9ae5a99 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -782,9 +782,11 @@ int Screen::getScreenLineColumns(const int line) const void Screen::reset(bool softReset, bool preservePrompt) { - // Clear screen, but preserve the current line + setDefaultRendition(); + if (!softReset) { if (preservePrompt) { + // Clear screen, but preserve the current line and X position scrollUp(0, _cuY); _cuY = 0; if (_hasGraphics) { @@ -821,7 +823,6 @@ void Screen::reset(bool softReset, bool preservePrompt) // Other terminal emulators reset the entire scroll history during a reset // setScroll(getScroll(), false); - setDefaultRendition(); saveCursor(); // DECSTR homes the saved cursor even though it doesn't home the current cursor