Editor: add a ReplaceLast select mode

This commit is contained in:
Maxime Coste 2013-01-03 14:00:31 +01:00
parent 9fb0129061
commit 02b9fcc3df
2 changed files with 8 additions and 0 deletions

View File

@ -241,6 +241,8 @@ void Editor::select(const Selection& selection, SelectMode mode)
m_selections.push_back(selection);
sort_and_merge_overlapping(m_selections);
}
else
assert(false);
check_invariant();
}
@ -262,6 +264,11 @@ void Editor::select(const Selector& selector, SelectMode mode)
res.captures() = sel.captures();
m_selections.push_back(res);
}
else if (mode == SelectMode::ReplaceLast)
{
auto& sel = m_selections.back();
sel = selector(sel);
}
else
{
for (auto& sel : m_selections)

View File

@ -18,6 +18,7 @@ enum class SelectMode
Replace,
Extend,
Append,
ReplaceLast,
};
enum class InsertMode : unsigned