Browse Source

Fix pagebreak-iterators.

Oopsie! 😄
main
tastytea 1 year ago
parent
commit
9067b387ef
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
  1. 8
      src/search.cpp

8
src/search.cpp

@ -136,6 +136,8 @@ void cleanup_text(string &text)
size_t pos{};
while ((pos = text.find('<', pos)) != string::npos)
{
auto endpos{text.find('>', pos) + 1};
// Mark headlines. We need them later on.
string replacement;
if (boost::regex_match(text.substr(pos, 3), re_header_start))
@ -148,13 +150,11 @@ void cleanup_text(string &text)
}
else if (text.substr(pos, 6) == "<span ")
{
auto endpos{text.find('>')};
boost::match_results<string::const_iterator> match;
using it_size_t = string::const_iterator::difference_type;
string::const_iterator begin{text.begin()
+ static_cast<it_size_t>(pos)};
string::const_iterator end{text.end()
string::const_iterator end{text.begin()
+ static_cast<it_size_t>(endpos)};
if (boost::regex_search(begin, end, match, re_pagebreak))
@ -168,7 +168,7 @@ void cleanup_text(string &text)
pos = text.find('>', pos) + 1;
}
text.replace(pos, text.find('>', pos) + 1 - pos, replacement);
text.replace(pos, endpos - pos, replacement);
pos += replacement.length();
}

Loading…
Cancel
Save