summaryrefslogtreecommitdiff
path: root/src/selectors.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-10-11 19:24:01 +0800
committerMaxime Coste <mawww@kakoune.org>2017-11-01 14:05:14 +0800
commit2b97e4e124abd675ccbeef80fff4722d9f7b0fe3 (patch)
treed7b459dcbd33c02c465eeaeaea03f55214a57ab2 /src/selectors.cc
parent3c999aba3758188c91143c3c16742faa168b06df (diff)
Regex: Fix handling of ^ and $ in backward matching mode
Diffstat (limited to 'src/selectors.cc')
-rw-r--r--src/selectors.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/selectors.cc b/src/selectors.cc
index c7f237c2..0585c63c 100644
--- a/src/selectors.cc
+++ b/src/selectors.cc
@@ -881,7 +881,7 @@ Selection find_next_match(const Context& context, const Selection& sel, const Re
wrapped = false;
const bool found = (direction == MatchDirection::Forward) ?
find_next(buffer, utf8::next(pos, buffer.end()), matches, regex, wrapped)
- : find_prev(buffer, pos, matches, regex, wrapped);
+ : find_prev(buffer, utf8::previous(pos, buffer.begin()), matches, regex, wrapped);
if (not found or matches[0].first == buffer.end())
throw runtime_error(format("'{}': no matches found", regex.str()));