diff --git a/src/editor.cc b/src/editor.cc index 380c07ba..eeffe41f 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -306,8 +306,7 @@ bool Editor::undo() if (res) { m_selections.clear(); - m_selections.push_back(Selection(listener.first(), - listener.last())); + m_selections.emplace_back(listener.first(), listener.last()); } return res; } @@ -319,8 +318,7 @@ bool Editor::redo() if (res) { m_selections.clear(); - m_selections.push_back(Selection(listener.first(), - listener.last())); + m_selections.emplace_back(listener.first(), listener.last()); } return res; } diff --git a/src/selection.hh b/src/selection.hh index 3de6937e..a75c9e3c 100644 --- a/src/selection.hh +++ b/src/selection.hh @@ -62,13 +62,11 @@ struct SelectionAndCaptures SelectionAndCaptures(const BufferIterator& first, const BufferIterator& last, - CaptureList captures_list) + CaptureList captures_list = {}) : selection(first, last), captures(std::move(captures_list)) {} SelectionAndCaptures(const Selection& sel, - CaptureList captures_list) + CaptureList captures_list = {}) : selection(sel), captures(std::move(captures_list)) {} - SelectionAndCaptures(const Selection& sel) - : selection(sel) {} // helper to access the selection BufferIterator begin() const { return selection.begin(); }