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 10d91b0249)
This commit is contained in:
Fabian Boehm 2023-09-30 15:27:37 +02:00
parent 3027bc355b
commit 577dc2be94

View file

@ -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<int>(i));
this->write_mbs(clr_eol);
}