|
|
@ -81,7 +81,6 @@ namespace MWGui
|
|
|
|
|
|
|
|
|
|
|
|
if (type == Event_ImgTag)
|
|
|
|
if (type == Event_ImgTag)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mIgnoreLineEndings = false;
|
|
|
|
|
|
|
|
mIgnoreNewlineTags = false;
|
|
|
|
mIgnoreNewlineTags = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -200,6 +199,7 @@ namespace MWGui
|
|
|
|
BookTextParser parser(markup);
|
|
|
|
BookTextParser parser(markup);
|
|
|
|
|
|
|
|
|
|
|
|
bool brBeforeLastTag = false;
|
|
|
|
bool brBeforeLastTag = false;
|
|
|
|
|
|
|
|
bool isPrevImg = false;
|
|
|
|
for (;;)
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BookTextParser::Events event = parser.next();
|
|
|
|
BookTextParser::Events event = parser.next();
|
|
|
@ -212,21 +212,16 @@ namespace MWGui
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Each block of text (between two tags / boundary and tag) will be displayed in a separate editbox widget,
|
|
|
|
// Each block of text (between two tags / boundary and tag) will be displayed in a separate editbox widget,
|
|
|
|
// which means an additonal linebreak will be created.
|
|
|
|
// which means an additonal linebreak will be created between them.
|
|
|
|
// ^ This is not the case in vanilla MW (though having multiple tags in one line seems to result in undefined behavior).
|
|
|
|
// ^ This is not what vanilla MW assumes, so we must deal with line breaks around tags appropriately.
|
|
|
|
// We must deal with linebreaks around tags appropriately.
|
|
|
|
bool brAtStart = (plainText[0] == '\n');
|
|
|
|
{
|
|
|
|
bool brAtEnd = (plainText[plainText.size()-1] == '\n');
|
|
|
|
bool brAtStart = (plainText[0] == '\n');
|
|
|
|
|
|
|
|
bool brAtEnd = (plainText[plainText.size()-1] == '\n');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!brBeforeLastTag && brAtStart)
|
|
|
|
|
|
|
|
plainText.erase(plainText.begin());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (plainText.size() && brAtEnd)
|
|
|
|
if (brAtStart && !brBeforeLastTag && !isPrevImg)
|
|
|
|
plainText.erase(plainText.end()-1);
|
|
|
|
plainText.erase(plainText.begin());
|
|
|
|
|
|
|
|
|
|
|
|
brBeforeLastTag = brAtEnd;
|
|
|
|
if (plainText.size() && brAtEnd)
|
|
|
|
}
|
|
|
|
plainText.erase(plainText.end()-1);
|
|
|
|
|
|
|
|
|
|
|
|
#if (MYGUI_VERSION < MYGUI_DEFINE_VERSION(3, 2, 2))
|
|
|
|
#if (MYGUI_VERSION < MYGUI_DEFINE_VERSION(3, 2, 2))
|
|
|
|
// splitting won't be fully functional until 3.2.2 (see TextElement::pageSplit())
|
|
|
|
// splitting won't be fully functional until 3.2.2 (see TextElement::pageSplit())
|
|
|
@ -238,16 +233,20 @@ namespace MWGui
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (!plainText.empty())
|
|
|
|
if (!plainText.empty() || brBeforeLastTag || isPrevImg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TextElement elem(paper, pag, mTextStyle, plainText);
|
|
|
|
TextElement elem(paper, pag, mTextStyle, plainText);
|
|
|
|
elem.paginate();
|
|
|
|
elem.paginate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
brBeforeLastTag = brAtEnd;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (event == BookTextParser::Event_EOF)
|
|
|
|
if (event == BookTextParser::Event_EOF)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isPrevImg = (event == BookTextParser::Event_ImgTag);
|
|
|
|
|
|
|
|
|
|
|
|
switch (event)
|
|
|
|
switch (event)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case BookTextParser::Event_ImgTag:
|
|
|
|
case BookTextParser::Event_ImgTag:
|
|
|
|