diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-05-12 23:25:15 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-05-13 20:09:06 +0100 |
| commit | ea3e92aa5e68e73fa95196332b739891bbf3f24f (patch) | |
| tree | 1b91673cdbec34a9dcb592858890fc6db1255ff9 /src/dynamic_selection_list.cc | |
| parent | 7bc73b7ef9402f81a6bb496b03ba84197f76e642 (diff) | |
SelectionList know its buffer and timestamp
Diffstat (limited to 'src/dynamic_selection_list.cc')
| -rw-r--r-- | src/dynamic_selection_list.cc | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/src/dynamic_selection_list.cc b/src/dynamic_selection_list.cc index 2792da30..4087bb0c 100644 --- a/src/dynamic_selection_list.cc +++ b/src/dynamic_selection_list.cc @@ -3,10 +3,9 @@ namespace Kakoune { -DynamicSelectionList::DynamicSelectionList(Buffer& buffer, - SelectionList selections) +DynamicSelectionList::DynamicSelectionList(SelectionList selections) : SelectionList(std::move(selections)), - BufferChangeListener_AutoRegister(buffer) + BufferChangeListener_AutoRegister(const_cast<Buffer&>(buffer())) { check_invariant(); } @@ -18,32 +17,16 @@ DynamicSelectionList& DynamicSelectionList::operator=(SelectionList selections) return *this; } -void DynamicSelectionList::check_invariant() const -{ -#ifdef KAK_DEBUG - SelectionList::check_invariant(); - const Buffer& buffer = registry(); - for (size_t i = 0; i < size(); ++i) - { - auto& sel = (*this)[i]; - kak_assert(buffer.is_valid(sel.anchor())); - kak_assert(buffer.is_valid(sel.cursor())); - kak_assert(not buffer.is_end(sel.anchor())); - kak_assert(not buffer.is_end(sel.cursor())); - kak_assert(utf8::is_character_start(buffer.iterator_at(sel.anchor()))); - kak_assert(utf8::is_character_start(buffer.iterator_at(sel.cursor()))); - } -#endif -} - void DynamicSelectionList::on_insert(const Buffer& buffer, ByteCoord begin, ByteCoord end, bool at_end) { update_insert(begin, end, at_end); + set_timestamp(buffer.timestamp()); } void DynamicSelectionList::on_erase(const Buffer& buffer, ByteCoord begin, ByteCoord end, bool at_end) { update_erase(begin, end, at_end); + set_timestamp(buffer.timestamp()); } } |
