fix textbox rendering issue

wrong background color for selected text of RTL languges
This commit is contained in:
Jinhao 2020-03-24 22:14:08 +08:00
parent 1597c62aa1
commit 48d54faeed

View File

@ -3483,9 +3483,14 @@ namespace nana {
void rtl_string(point strpos, const wchar_t* str, std::size_t len, std::size_t str_px, unsigned glyph_front, unsigned glyph_selected, bool has_focused) void rtl_string(point strpos, const wchar_t* str, std::size_t len, std::size_t str_px, unsigned glyph_front, unsigned glyph_selected, bool has_focused)
{ {
editor_._m_draw_parse_string(parser_, true, strpos, selection_color(true, has_focused), str, len); //Draw twices for RTL language in order to avoid character transforming.
//one is to draw whole string as unselected, another one is to draw whole string as selected.
//Draw as unselected
editor_._m_draw_parse_string(parser_, true, strpos, editor_.scheme_->foreground, str, len);
//Draw selected part
//Draw as selected, and copy the selected part to the graph.
paint::graphics graph({ glyph_selected, line_px_ }); paint::graphics graph({ glyph_selected, line_px_ });
graph.typeface(this->graph_.typeface()); graph.typeface(this->graph_.typeface());
graph.rectangle(true, selection_color(false, has_focused)); graph.rectangle(true, selection_color(false, has_focused));