1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00

Merge branch 'books' into 'master'

Only ignore plain text after the last EOL tag (#5627)

Closes #5627

See merge request OpenMW/openmw!492
This commit is contained in:
Evil Eye 2020-12-27 14:25:57 +00:00
commit 7d8727b98e
3 changed files with 17 additions and 9 deletions

View File

@ -64,6 +64,7 @@
Bug #5604: Only one valid NIF root node is loaded from a single file Bug #5604: Only one valid NIF root node is loaded from a single file
Bug #5611: Usable items with "0 Uses" should be used only once Bug #5611: Usable items with "0 Uses" should be used only once
Bug #5622: Can't properly interact with the console when in pause menu Bug #5622: Can't properly interact with the console when in pause menu
Bug #5627: Bookart not shown if it isn't followed by <BR> statement
Bug #5633: Damage Spells in effect before god mode is enabled continue to hurt the player character and can kill them Bug #5633: Damage Spells in effect before god mode is enabled continue to hurt the player character and can kill them
Bug #5639: Tooltips cover Messageboxes Bug #5639: Tooltips cover Messageboxes
Bug #5644: Summon effects running on the player during game initialization cause crashes Bug #5644: Summon effects running on the player during game initialization cause crashes

View File

@ -30,14 +30,18 @@ namespace MWGui
// vanilla game does not show any text after the last EOL tag. // vanilla game does not show any text after the last EOL tag.
const std::string lowerText = Misc::StringUtils::lowerCase(mText); const std::string lowerText = Misc::StringUtils::lowerCase(mText);
int brIndex = lowerText.rfind("<br>"); size_t brIndex = lowerText.rfind("<br>");
int pIndex = lowerText.rfind("<p>"); size_t pIndex = lowerText.rfind("<p>");
if (brIndex == pIndex) mPlainTextEnd = 0;
mText = ""; if (brIndex != pIndex)
else if (brIndex > pIndex) {
mText = mText.substr(0, brIndex+4); if (brIndex != std::string::npos && pIndex != std::string::npos)
else mPlainTextEnd = std::max(brIndex, pIndex);
mText = mText.substr(0, pIndex+3); else if (brIndex != std::string::npos)
mPlainTextEnd = brIndex;
else
mPlainTextEnd = pIndex;
}
registerTag("br", Event_BrTag); registerTag("br", Event_BrTag);
registerTag("p", Event_PTag); registerTag("p", Event_PTag);
@ -103,7 +107,8 @@ namespace MWGui
{ {
if (!mIgnoreLineEndings || ch != '\n') if (!mIgnoreLineEndings || ch != '\n')
{ {
mBuffer.push_back(ch); if (mIndex < mPlainTextEnd)
mBuffer.push_back(ch);
mIgnoreLineEndings = false; mIgnoreLineEndings = false;
mIgnoreNewlineTags = false; mIgnoreNewlineTags = false;
} }

View File

@ -73,6 +73,8 @@ namespace MWGui
bool mClosingTag; bool mClosingTag;
std::map<std::string, Events> mTagTypes; std::map<std::string, Events> mTagTypes;
std::string mBuffer; std::string mBuffer;
size_t mPlainTextEnd;
}; };
class Paginator class Paginator