Remove now trivial Selection::merge_with method

This commit is contained in:
Maxime Coste 2017-08-18 08:52:40 +07:00
parent 609a8ee8c7
commit 82d23bc400
3 changed files with 2 additions and 9 deletions

View File

@ -63,7 +63,7 @@ void select(Context& context, T func)
} }
if (mode == SelectMode::Extend) if (mode == SelectMode::Extend)
sel.merge_with(*res); sel.cursor() = res->cursor();
else else
{ {
sel.anchor() = res->anchor(); sel.anchor() = res->anchor();
@ -772,7 +772,7 @@ void search(Context& context, NormalParams params)
if (mode == SelectMode::Replace) if (mode == SelectMode::Replace)
sel = keep_direction(find_next_match<direction>(context, sel, regex, wrapped), sel); sel = keep_direction(find_next_match<direction>(context, sel, regex, wrapped), sel);
if (mode == SelectMode::Extend) if (mode == SelectMode::Extend)
sel.merge_with(find_next_match<direction>(context, sel, regex, wrapped)); sel.cursor() = find_next_match<direction>(context, sel, regex, wrapped).cursor();
} }
selections.sort_and_merge_overlapping(); selections.sort_and_merge_overlapping();
} while (--c > 0); } while (--c > 0);

View File

@ -7,11 +7,6 @@
namespace Kakoune namespace Kakoune
{ {
void Selection::merge_with(const Selection& other)
{
m_cursor = other.m_cursor;
}
SelectionList::SelectionList(Buffer& buffer, Selection s, size_t timestamp) SelectionList::SelectionList(Buffer& buffer, Selection s, size_t timestamp)
: m_buffer(&buffer), m_selections({ std::move(s) }), m_timestamp(timestamp) : m_buffer(&buffer), m_selections({ std::move(s) }), m_timestamp(timestamp)
{ {

View File

@ -20,8 +20,6 @@ struct Selection
: m_anchor{anchor}, m_cursor{cursor}, : m_anchor{anchor}, m_cursor{cursor},
m_captures(std::move(captures)) {} m_captures(std::move(captures)) {}
void merge_with(const Selection& range);
BufferCoord& anchor() { return m_anchor; } BufferCoord& anchor() { return m_anchor; }
BufferCoordAndTarget& cursor() { return m_cursor; } BufferCoordAndTarget& cursor() { return m_cursor; }