Browse Source

Don't search for whitespace beyond the start/end of the text.

main
tastytea 1 year ago
parent
commit
f59c86e20d
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
  1. 15
      src/search.cpp

15
src/search.cpp

@ -232,12 +232,10 @@ match_context context(const boost::match_results<string::const_iterator> &match,
pos_before = std::find_first_of(pos_before, rend_before,
whitespace.begin(),
whitespace.end());
if (pos_before != rend_before)
while (pos_before != rend_before
&& helpers::is_whitespace(*pos_before))
{
while (helpers::is_whitespace(*pos_before))
{
++pos_before;
}
++pos_before;
}
}
@ -246,12 +244,9 @@ match_context context(const boost::match_results<string::const_iterator> &match,
pos_after = std::find_first_of(pos_after, end_after,
whitespace.begin(),
whitespace.end());
if (pos_after != end_after)
while (pos_after != end_after && helpers::is_whitespace(*pos_after))
{
while (helpers::is_whitespace(*pos_after))
{
++pos_after;
}
++pos_after;
}
}
words -= 1;

Loading…
Cancel
Save