strbuffer: fix issue with order of properties with the same position

This commit is contained in:
Andrzej Rybczak
2015-09-09 19:12:57 +02:00
parent b9a0608053
commit 71fa345280
3 changed files with 31 additions and 62 deletions

View File

@@ -36,8 +36,8 @@ bool regexSearch(NC::Buffer &buf, PropT begin, const std::string &ws, PropT end,
bool success = first != last;
for (; first != last; ++first)
{
buf.setProperty(first->position(), begin, id);
buf.setProperty(first->position() + first->length(), end, id);
buf.addProperty(first->position(), begin, id);
buf.addProperty(first->position() + first->length(), end, id);
}
return success;
} catch (boost::bad_expression &e) {
@@ -147,8 +147,8 @@ void Scrollpad::flush()
size_t i = 0;
auto load_properties = [&]() {
for (; p != ps.end() && p->position() == i; ++p)
w << *p;
for (; p != ps.end() && p->first == i; ++p)
w << p->second;
};
auto write_whitespace = [&]() {
for (; i < s.length() && iswspace(s[i]); ++i)
@@ -257,7 +257,7 @@ void Scrollpad::flush()
}
// load remaining properties if there are any
for (; p != ps.end(); ++p)
w << *p;
w << p->second;
return height;
};
m_real_height = std::max(write_buffer(true), m_height);