diff --git a/apps/openmw/mwgui/formatting.cpp b/apps/openmw/mwgui/formatting.cpp
index 16568e2f3..edcb94eed 100644
--- a/apps/openmw/mwgui/formatting.cpp
+++ b/apps/openmw/mwgui/formatting.cpp
@@ -31,13 +31,16 @@ namespace MWGui
boost::algorithm::replace_all(mText, "\r", "");
- // vanilla game does not show any text after last
tag.
+ // vanilla game does not show any text after the last EOL tag.
const std::string lowerText = Misc::StringUtils::lowerCase(mText);
- int index = lowerText.rfind("
");
- if (index == -1)
+ int brIndex = lowerText.rfind("
");
+ int pIndex = lowerText.rfind("
"); + if (brIndex == pIndex) mText = ""; + else if (brIndex > pIndex) + mText = mText.substr(0, brIndex+4); else - mText = mText.substr(0, index+4); + mText = mText.substr(0, pIndex+3); registerTag("br", Event_BrTag); registerTag("p", Event_PTag);