move overlaps function to selection.hh

This commit is contained in:
Maxime Coste 2012-11-12 20:27:56 +01:00
parent 77272db0fd
commit 14f980e4e0
2 changed files with 8 additions and 7 deletions

View File

@ -99,13 +99,6 @@ std::vector<String> Editor::selections_content() const
return contents; return contents;
} }
static bool overlaps(const SelectionAndCaptures& lhs,
const SelectionAndCaptures& rhs)
{
return (lhs.first() <= rhs.first() and lhs.last() >= rhs.first()) or
(lhs.first() <= rhs.last() and lhs.last() >= rhs.last());
}
static void merge_overlapping(SelectionAndCapturesList& selections) static void merge_overlapping(SelectionAndCapturesList& selections)
{ {
for (size_t i = 0; i < selections.size(); ++i) for (size_t i = 0; i < selections.size(); ++i)

View File

@ -75,6 +75,14 @@ struct SelectionAndCaptures
const BufferIterator& last() const { return selection.last(); } const BufferIterator& last() const { return selection.last(); }
}; };
inline bool overlaps(const SelectionAndCaptures& lhs,
const SelectionAndCaptures& rhs)
{
return (lhs.first() <= rhs.first() and lhs.last() >= rhs.first()) or
(lhs.first() <= rhs.last() and lhs.last() >= rhs.last());
}
typedef std::vector<SelectionAndCaptures> SelectionAndCapturesList; typedef std::vector<SelectionAndCaptures> SelectionAndCapturesList;
} }