Rework SelectionList::check_invariant
This commit is contained in:
parent
13ed87410f
commit
80c3405a20
|
@ -400,15 +400,21 @@ void SelectionList::check_invariant() const
|
||||||
if (timestamp != m_timestamp)
|
if (timestamp != m_timestamp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (size_t i = 0; i < size(); ++i)
|
const auto end_coord = buffer.end_coord();
|
||||||
|
ByteCoord last_min{0,0};
|
||||||
|
for (auto& sel : m_selections)
|
||||||
{
|
{
|
||||||
auto& sel = (*this)[i];
|
auto& min = sel.min();
|
||||||
if (i+1 < size())
|
kak_assert(min >= last_min);
|
||||||
kak_assert((*this)[i].min() <= (*this)[i+1].min());
|
last_min = min;
|
||||||
kak_assert(buffer.is_valid(sel.anchor()));
|
|
||||||
kak_assert(buffer.is_valid(sel.cursor()));
|
const auto anchor = sel.anchor();
|
||||||
kak_assert(not buffer.is_end(sel.anchor()));
|
kak_assert(anchor >= ByteCoord{0,0} and anchor < end_coord);
|
||||||
kak_assert(not buffer.is_end(sel.cursor()));
|
kak_assert(anchor.column < buffer[anchor.line].length());
|
||||||
|
|
||||||
|
const auto cursor = sel.cursor();
|
||||||
|
kak_assert(cursor >= ByteCoord{0,0} and cursor < end_coord);
|
||||||
|
kak_assert(cursor.column < buffer[cursor.line].length());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user