summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-05-17 12:13:49 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-05-17 12:13:49 +0100
commit079d34b82a3690f28de3d33102eda4bb214ad13f (patch)
treeaf757529567b9d6b501a1bd05eaf9dcfd5921773 /src
parent211b78f5369a61bb3ae72e882373c6823c7c202a (diff)
Minor cleanup in SelectionList methods
Diffstat (limited to 'src')
-rw-r--r--src/normal.cc4
-rw-r--r--src/selection.hh4
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> 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;