diff --git a/CHANGELOG.md b/CHANGELOG.md index dfdfb9e8..ced61f88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,8 @@ [#981](https://github.com/reupen/columns_ui/pull/981), [#981](https://github.com/reupen/columns_ui/pull/989), [#1030](https://github.com/reupen/columns_ui/pull/1030), - [#1031](https://github.com/reupen/columns_ui/pull/1031)] + [#1031](https://github.com/reupen/columns_ui/pull/1031), + [#1037](https://github.com/reupen/columns_ui/pull/1037)] This includes colour font support on Windows 8.1 and newer (allowing the use of, for example, colour emojis). diff --git a/foo_ui_columns/item_details_text.cpp b/foo_ui_columns/item_details_text.cpp index a245d80b..60941aaa 100644 --- a/foo_ui_columns/item_details_text.cpp +++ b/foo_ui_columns/item_details_text.cpp @@ -198,24 +198,22 @@ std::tuple, std::vector colour_segment_start) + coloured_segments.emplace_back( + *cr_current, colour_segment_start, stripped_text.length() - colour_segment_start); - if (current_font && (is_eos || is_font_code)) { - FormatProperties cleaned_font{*current_font}; - for_each_property(cleaned_font, [](auto&& member) { - if (member && std::holds_alternative(*member)) { - member.reset(); - } - }); + if (current_font && (is_eos || is_font_code) && stripped_text.length() > font_segment_start) { + FormatProperties cleaned_font{*current_font}; + for_each_property(cleaned_font, [](auto&& member) { + if (member && std::holds_alternative(*member)) { + member.reset(); + } + }); - font_segments.emplace_back( - cleaned_font, font_segment_start, stripped_text.length() - font_segment_start); - } + font_segments.emplace_back(cleaned_font, font_segment_start, stripped_text.length() - font_segment_start); } if (is_eos)