xW: render leaked lines a bit more accurately

There is no need to reset all text attributes, just the colour.
This commit is contained in:
Přemysl Eric Janouch 2023-08-25 17:31:32 +02:00
parent 34521e61c1
commit e5156cddbf
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -678,14 +678,12 @@ buffer_print_line(std::vector<BufferLine>::const_iterator begin,
if (!prefix.empty())
richedit_replacesel(g.hwndBuffer, &pcf, prefix.c_str());
std::wstring text;
for (const auto &it : line->items)
text += it.text;
CHARFORMAT2 format = default_charformat();
format.dwEffects &= ~CFE_AUTOCOLOR;
format.crTextColor = GetSysColor(COLOR_GRAYTEXT);
richedit_replacesel(g.hwndBuffer, &format, text.c_str());
for (auto it : line->items) {
it.format.dwEffects &= ~CFE_AUTOCOLOR;
it.format.crTextColor = GetSysColor(COLOR_GRAYTEXT);
it.format.dwEffects |= CFE_AUTOBACKCOLOR;
richedit_replacesel(g.hwndBuffer, &it.format, it.text.c_str());
}
} else {
if (!prefix.empty())
richedit_replacesel(g.hwndBuffer, &pcf, prefix.c_str());