diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-05-14 00:59:36 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-05-14 19:49:04 +0100 |
| commit | bf98b38afd5338f6be617cfaf4bb251eb011e2b0 (patch) | |
| tree | 7832efaa75e4a6da23d57cf2672d60ce59c779d7 /src/selection.cc | |
| parent | db423e4a88be8799ce0cfae33ddbf4c6bae97e5f (diff) | |
Use a plain SelectionList for Context, remove DynamicSelectionList
Diffstat (limited to 'src/selection.cc')
| -rw-r--r-- | src/selection.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/selection.cc b/src/selection.cc index 0d90cc35..746253f9 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -134,6 +134,9 @@ void update_erase(std::vector<Selection>& sels, ByteCoord begin, ByteCoord end, void SelectionList::update() { + if (m_timestamp == m_buffer->timestamp()) + return; + for (auto& change : m_buffer->changes_since(m_timestamp)) { if (change.type == Buffer::Change::Insert) @@ -141,9 +144,10 @@ void SelectionList::update() else update_erase(m_selections, change.begin, change.end, change.at_end); } - m_timestamp = m_buffer->timestamp(); check_invariant(); + + m_timestamp = m_buffer->timestamp(); } void SelectionList::check_invariant() const @@ -152,12 +156,11 @@ void SelectionList::check_invariant() const auto& buffer = this->buffer(); kak_assert(size() > 0); kak_assert(m_main < size()); - for (size_t i = 0; i+1 < size(); ++ i) - kak_assert((*this)[i].min() <= (*this)[i+1].min()); - for (size_t i = 0; i < size(); ++i) { auto& sel = (*this)[i]; + if (i+1 < size()) + kak_assert((*this)[i].min() <= (*this)[i+1].min()); kak_assert(buffer.is_valid(sel.anchor())); kak_assert(buffer.is_valid(sel.cursor())); kak_assert(not buffer.is_end(sel.anchor())); |
