Remove 'ReplaceMain' select mode

This commit is contained in:
Maxime Coste 2014-07-05 12:37:49 +01:00
parent a61db7ef5e
commit fc7f017372

View File

@ -27,7 +27,6 @@ enum class SelectMode
Replace, Replace,
Extend, Extend,
Append, Append,
ReplaceMain,
}; };
template<SelectMode mode = SelectMode::Replace, typename Func> template<SelectMode mode = SelectMode::Replace, typename Func>
@ -44,15 +43,6 @@ void select(Context& context, Func func)
selections.push_back(res); selections.push_back(res);
selections.set_main_index(selections.size() - 1); selections.set_main_index(selections.size() - 1);
} }
else if (mode == SelectMode::ReplaceMain)
{
auto& sel = selections.main();
auto res = func(buffer, sel);
sel.anchor() = res.anchor();
sel.cursor() = res.cursor();
if (not res.captures().empty())
sel.captures() = std::move(res.captures());
}
else else
{ {
for (auto& sel : selections) for (auto& sel : selections)
@ -429,8 +419,6 @@ void select_next_match(const Buffer& buffer, SelectionList& selections,
for (auto& sel : selections) for (auto& sel : selections)
sel.merge_with(find_next_match<direction>(buffer, sel, regex)); sel.merge_with(find_next_match<direction>(buffer, sel, regex));
} }
else if (mode == SelectMode::ReplaceMain)
selections.main() = find_next_match<direction>(buffer, selections.main(), regex);
else if (mode == SelectMode::Append) else if (mode == SelectMode::Append)
{ {
selections.push_back(find_next_match<direction>(buffer, selections.main(), regex)); selections.push_back(find_next_match<direction>(buffer, selections.main(), regex));