minor code simplification

This commit is contained in:
Maxime Coste 2012-11-26 18:50:34 +01:00
parent 9effba2c66
commit e77ca7a4be
2 changed files with 4 additions and 8 deletions

View File

@ -306,8 +306,7 @@ bool Editor::undo()
if (res) if (res)
{ {
m_selections.clear(); m_selections.clear();
m_selections.push_back(Selection(listener.first(), m_selections.emplace_back(listener.first(), listener.last());
listener.last()));
} }
return res; return res;
} }
@ -319,8 +318,7 @@ bool Editor::redo()
if (res) if (res)
{ {
m_selections.clear(); m_selections.clear();
m_selections.push_back(Selection(listener.first(), m_selections.emplace_back(listener.first(), listener.last());
listener.last()));
} }
return res; return res;
} }

View File

@ -62,13 +62,11 @@ struct SelectionAndCaptures
SelectionAndCaptures(const BufferIterator& first, SelectionAndCaptures(const BufferIterator& first,
const BufferIterator& last, const BufferIterator& last,
CaptureList captures_list) CaptureList captures_list = {})
: selection(first, last), captures(std::move(captures_list)) {} : selection(first, last), captures(std::move(captures_list)) {}
SelectionAndCaptures(const Selection& sel, SelectionAndCaptures(const Selection& sel,
CaptureList captures_list) CaptureList captures_list = {})
: selection(sel), captures(std::move(captures_list)) {} : selection(sel), captures(std::move(captures_list)) {}
SelectionAndCaptures(const Selection& sel)
: selection(sel) {}
// helper to access the selection // helper to access the selection
BufferIterator begin() const { return selection.begin(); } BufferIterator begin() const { return selection.begin(); }