home/src/dynamic_selection_list.cc

43 lines
966 B
C++
Raw Normal View History

#include "dynamic_selection_list.hh"
namespace Kakoune
{
DynamicSelectionList::DynamicSelectionList(const Buffer& buffer,
SelectionList selections)
: SelectionList(std::move(selections)),
BufferChangeListener_AutoRegister(buffer)
{
check_invariant();
}
DynamicSelectionList& DynamicSelectionList::operator=(SelectionList selections)
{
SelectionList::operator=(std::move(selections));
check_invariant();
return *this;
}
void DynamicSelectionList::check_invariant() const
{
2013-02-27 19:03:33 +01:00
#ifdef KAK_DEBUG
2013-05-03 13:38:48 +02:00
if (empty())
return;
const Buffer* buf = &buffer();
2013-05-03 13:38:48 +02:00
kak_assert(&front().buffer() == buf);
SelectionList::check_invariant();
2013-02-27 19:03:33 +01:00
#endif
}
void DynamicSelectionList::on_insert(const BufferCoord& begin, const BufferCoord& end)
{
update_insert(begin, end);
}
void DynamicSelectionList::on_erase(const BufferCoord& begin, const BufferCoord& end)
{
update_erase(begin, end);
}
}