From 079d34b82a3690f28de3d33102eda4bb214ad13f Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 17 May 2014 12:13:49 +0100 Subject: [PATCH] Minor cleanup in SelectionList methods --- src/normal.cc | 4 ++-- src/selection.hh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/normal.cc b/src/normal.cc index ff38c29d..0e2d3b38 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -79,7 +79,7 @@ void insert(Buffer& buffer, SelectionList& selections, const String& str) } } if (mode == InsertMode::Replace) - selections.set_timestamp(buffer.timestamp()); + selections.update_timestamp(); else selections.update(); selections.avoid_eol(); @@ -108,7 +108,7 @@ void insert(Buffer& buffer, SelectionList& selections, memoryview string } } if (mode == InsertMode::Replace) - selections.set_timestamp(buffer.timestamp()); + selections.update_timestamp(); else selections.update(); selections.avoid_eol(); diff --git a/src/selection.hh b/src/selection.hh index 5f0ce459..cd60f817 100644 --- a/src/selection.hh +++ b/src/selection.hh @@ -86,6 +86,7 @@ struct SelectionList m_selections = std::move(list); m_main = size()-1; sort_and_merge_overlapping(); + update_timestamp(); check_invariant(); return *this; } @@ -115,7 +116,6 @@ struct SelectionList } size_t size() const { return m_selections.size(); } - bool empty() const { return m_selections.empty(); } bool operator==(const SelectionList& other) const { return m_buffer == other.m_buffer and m_selections == other.m_selections; } bool operator!=(const SelectionList& other) const { return !((*this) == other); } @@ -149,7 +149,7 @@ struct SelectionList const Buffer& buffer() const { return *m_buffer; } size_t timestamp() const { return m_timestamp; } - void set_timestamp(size_t timestamp) { m_timestamp = timestamp; } + void update_timestamp() { m_timestamp = m_buffer->timestamp(); } private: size_t m_main = 0;