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

pull/3036/head
Alexei Dobrohotov 3 years ago
parent fd5429ae56
commit fd77ef6b01

@ -63,6 +63,7 @@
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 #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 #5639: Tooltips cover Messageboxes
Bug #5644: Summon effects running on the player during game initialization cause crashes

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

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

Loading…
Cancel
Save