From 2b97e4e124abd675ccbeef80fff4722d9f7b0fe3 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 11 Oct 2017 19:24:01 +0800 Subject: Regex: Fix handling of ^ and $ in backward matching mode --- src/selectors.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/selectors.cc') 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())); -- cgit v1.2.3