aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-08-25 17:31:32 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-08-25 22:48:31 +0200
commite5156cddbf93f7c55868f5fb80a021b950f4a2c7 (patch)
tree71ebbf4858a43c3a6548d529cb7bf0187ab71e86
parent34521e61c1f0c44bc9018d5a7a861baf6888d5fc (diff)
downloadxK-e5156cddbf93f7c55868f5fb80a021b950f4a2c7.tar.gz
xK-e5156cddbf93f7c55868f5fb80a021b950f4a2c7.tar.xz
xK-e5156cddbf93f7c55868f5fb80a021b950f4a2c7.zip
xW: render leaked lines a bit more accurately
There is no need to reset all text attributes, just the colour.
-rw-r--r--xW/xW.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/xW/xW.cpp b/xW/xW.cpp
index 980f825..b05eb37 100644
--- a/xW/xW.cpp
+++ b/xW/xW.cpp
@@ -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());