Don't search for whitespace beyond the start/end of the text.
This commit is contained in:
parent
0470acb00e
commit
f59c86e20d
|
@ -232,28 +232,23 @@ match_context context(const boost::match_results<string::const_iterator> &match,
|
||||||
pos_before = std::find_first_of(pos_before, rend_before,
|
pos_before = std::find_first_of(pos_before, rend_before,
|
||||||
whitespace.begin(),
|
whitespace.begin(),
|
||||||
whitespace.end());
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (pos_after != end_after)
|
if (pos_after != end_after)
|
||||||
{
|
{
|
||||||
pos_after = std::find_first_of(pos_after, end_after,
|
pos_after = std::find_first_of(pos_after, end_after,
|
||||||
whitespace.begin(),
|
whitespace.begin(),
|
||||||
whitespace.end());
|
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;
|
words -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user