summaryrefslogtreecommitdiff
path: root/src/normal.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-09-25 13:29:53 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-09-25 13:29:53 +0100
commitecf8047bcc61ac87e9745f2e8600785972ff84cb (patch)
tree8c3249cdc10c71b725573a8f9ef6280f9515d6d5 /src/normal.cc
parent4c4d3cdd382438283a4774ef5d4cffb1d39181cf (diff)
Fix reverse search when extending
Diffstat (limited to 'src/normal.cc')
-rw-r--r--src/normal.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/normal.cc b/src/normal.cc
index 0c749e23..1de74b97 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -421,7 +421,7 @@ void select_next_match(const Buffer& buffer, SelectionList& selections,
if (mode == SelectMode::Replace)
{
for (auto& sel : selections)
- sel = find_next_match<direction>(buffer, sel, regex);
+ sel = keep_direction(find_next_match<direction>(buffer, sel, regex), sel);
}
if (mode == SelectMode::Extend)
{
@@ -430,7 +430,10 @@ void select_next_match(const Buffer& buffer, SelectionList& selections,
}
else if (mode == SelectMode::Append)
{
- selections.push_back(find_next_match<direction>(buffer, selections.main(), regex));
+ auto sel = keep_direction(
+ find_next_match<direction>(buffer, selections.main(), regex),
+ selections.main());
+ selections.push_back(std::move(sel));
selections.set_main_index(selections.size() - 1);
}
selections.sort_and_merge_overlapping();