From 577dc2be94a26e7663ba465c1892c8f08a7254a0 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sat, 30 Sep 2023 15:27:37 +0200 Subject: [PATCH] screen: Unset color at the end of a line even without clr_eol This is a sensible thing to do, and fixes some cases where we're state-dependent. E.g. this fixes the case in the pager where some things are bold and some aren't, because that bolding is (rather awkwardly) implicitly triggered when we have a background, and so we don't notice we need to re-do that bolding after we moved to the next line because we think we still have the same color. Fixes #9617 (cherry picked from commit 10d91b0249f57a5269ee5e1c0517da095fe3c820) --- src/screen.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/screen.cpp b/src/screen.cpp index ef8fbf16f..7cb6cf52f 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -878,8 +878,12 @@ void screen_t::update(const wcstring &left_prompt, const wcstring &right_prompt, clear_remainder = prev_width > current_width; } } + + // We unset the color even if we don't clear the line. + // This means that we switch background correctly on the next, + // including our weird implicit bolding. + set_color(highlight_spec_t{}); if (clear_remainder && clr_eol) { - set_color(highlight_spec_t{}); this->move(current_width, static_cast(i)); this->write_mbs(clr_eol); }