#include "selection.hh" #include "utf8.hh" namespace Kakoune { void Range::merge_with(const Range& range) { m_last = range.m_last; if (m_first < m_last) m_first = std::min(m_first, range.m_first); if (m_first > m_last) m_first = std::max(m_first, range.m_first); } void Range::check_invariant() const { #ifdef KAK_DEBUG kak_assert(m_first.is_valid() and not m_first.is_end()); kak_assert(m_last.is_valid() and not m_last.is_end()); kak_assert(utf8::is_character_start(m_first)); kak_assert(utf8::is_character_start(m_last)); #endif } namespace { template