Fix update of misspelled ranges

If nothing was misspelled in the updated range, and a value existed for the end of the range (indicating that what followed the updated range was misspelled) then that value would be erased.
This commit is contained in:
Allan Odgaard
2013-09-05 12:30:39 +02:00
parent 145a4f6386
commit 69be0205ba

View File

@@ -68,7 +68,11 @@ namespace ng
}
// TODO We should delay checking to the misspellings function. This way we wont spell check entire document on load etc.
_misspellings.remove(_misspellings.lower_bound(from), _misspellings.upper_bound(to));
auto fromIter = _misspellings.lower_bound(from);
auto toIter = _misspellings.upper_bound(to);
if(fromIter != toIter && fromIter->first >= to && fromIter->second)
fromIter = toIter;
_misspellings.remove(fromIter, toIter);
iterate(r, ranges)
{
std::string const& text = buffer->substr(r->first, r->second);