Remove Context::set_selections, use Context::selections() = ...

This commit is contained in:
Maxime Coste 2015-04-19 15:00:37 +01:00
parent b570c68c75
commit 9f65a4e6dd
3 changed files with 4 additions and 11 deletions

View File

@ -211,12 +211,6 @@ Vector<String> Context::selections_content() const
return contents; return contents;
} }
void Context::set_selections(Vector<Selection> sels)
{
*m_selections = std::move(sels);
(*m_selections).check_invariant();
}
void Context::begin_edition() void Context::begin_edition()
{ {
if (m_edition_level >= 0) if (m_edition_level >= 0)

View File

@ -89,7 +89,6 @@ public:
SelectionList& selections(); SelectionList& selections();
const SelectionList& selections() const; const SelectionList& selections() const;
Vector<String> selections_content() const; Vector<String> selections_content() const;
void set_selections(Vector<Selection> sels);
void change_buffer(Buffer& buffer); void change_buffer(Buffer& buffer);

View File

@ -766,7 +766,7 @@ void keep(Context& context, NormalParams)
} }
if (keep.empty()) if (keep.empty())
throw runtime_error("no selections remaining"); throw runtime_error("no selections remaining");
context.set_selections(std::move(keep)); context.selections() = std::move(keep);
}); });
} }
@ -788,7 +788,7 @@ void keep_pipe(Context& context, NormalParams)
} }
if (keep.empty()) if (keep.empty())
throw runtime_error("no selections remaining"); throw runtime_error("no selections remaining");
context.set_selections(std::move(keep)); context.selections() = std::move(keep);
}); });
} }
template<bool indent_empty = false> template<bool indent_empty = false>
@ -1267,7 +1267,7 @@ void undo(Context& context, NormalParams)
{ {
auto ranges = compute_modified_ranges(buffer, timestamp); auto ranges = compute_modified_ranges(buffer, timestamp);
if (not ranges.empty()) if (not ranges.empty())
context.set_selections(std::move(ranges)); context.selections() = std::move(ranges);
context.selections().avoid_eol(); context.selections().avoid_eol();
} }
else if (not res) else if (not res)
@ -1284,7 +1284,7 @@ void redo(Context& context, NormalParams)
{ {
auto ranges = compute_modified_ranges(buffer, timestamp); auto ranges = compute_modified_ranges(buffer, timestamp);
if (not ranges.empty()) if (not ranges.empty())
context.set_selections(std::move(ranges)); context.selections() = std::move(ranges);
context.selections().avoid_eol(); context.selections().avoid_eol();
} }