-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix rendering of highlighted URLs #16342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that throwing away the color info can produce a clean solution.
The cleanest solution is probably to utilize EnrichedString
properly.
src/gui/guiEditBoxWithScrollbar.cpp
Outdated
@@ -176,21 +177,36 @@ void GUIEditBoxWithScrollBar::draw() | |||
start_pos = ml ? m_broken_text_positions[i] : 0; | |||
} | |||
|
|||
//Create copy of string removing highlighting specifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're (incorrectly) reimplementing unescape_enriched
(found in src/util/string.h
) here.
src/gui/guiEditBoxWithScrollbar.cpp
Outdated
|
||
// draw normal text | ||
font->draw(txt_line->c_str(), m_current_text_rect, | ||
font->draw(plainString.c_str(), m_current_text_rect, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I would agree. (I am still getting familiar with the code base) So is there not already a string class that handles colour information and you are proposing to replace core::stringw with a new rich text class for all text rendering? |
Yes, there is
Yes, replacing |
Add compact, short information about your PR for easier understanding:
Fixes Highlighting the URL text in the "Open URL" window causes buggy text rendering #16246 where highlighting a url would cause some characters to appear and others to dissapear.
In the GUIEditBoxWithScrollBar::draw method it creates a copy of the string to be drawn and in this copy removes rich text formatting information and then draws the new string.
Highlighting the URL text in the "Open URL" window causes buggy text rendering #16246
To do
This PR Ready for Review
How to test
To test use infomation provided in #16246 issue.