Editor: add a ReplaceLast select mode
This commit is contained in:
parent
9fb0129061
commit
02b9fcc3df
|
@ -241,6 +241,8 @@ void Editor::select(const Selection& selection, SelectMode mode)
|
||||||
m_selections.push_back(selection);
|
m_selections.push_back(selection);
|
||||||
sort_and_merge_overlapping(m_selections);
|
sort_and_merge_overlapping(m_selections);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
assert(false);
|
||||||
check_invariant();
|
check_invariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +264,11 @@ void Editor::select(const Selector& selector, SelectMode mode)
|
||||||
res.captures() = sel.captures();
|
res.captures() = sel.captures();
|
||||||
m_selections.push_back(res);
|
m_selections.push_back(res);
|
||||||
}
|
}
|
||||||
|
else if (mode == SelectMode::ReplaceLast)
|
||||||
|
{
|
||||||
|
auto& sel = m_selections.back();
|
||||||
|
sel = selector(sel);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (auto& sel : m_selections)
|
for (auto& sel : m_selections)
|
||||||
|
|
|
@ -18,6 +18,7 @@ enum class SelectMode
|
||||||
Replace,
|
Replace,
|
||||||
Extend,
|
Extend,
|
||||||
Append,
|
Append,
|
||||||
|
ReplaceLast,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class InsertMode : unsigned
|
enum class InsertMode : unsigned
|
||||||
|
|
Loading…
Reference in New Issue
Block a user