diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-10-11 21:05:02 +0800 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-11-01 14:05:14 +0800 |
| commit | 8c8dcb3a840e0f6a2a0767ea0ee407aaed35c492 (patch) | |
| tree | d3bad5ef13e072f219e0c951edda0f97b3a18b83 /src/selectors.cc | |
| parent | 9753bcd0ad4aa8b01f25368251b46976807d4a48 (diff) | |
Regex: Fix reverse searching behaviour, again
Diffstat (limited to 'src/selectors.cc')
| -rw-r--r-- | src/selectors.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/selectors.cc b/src/selectors.cc index 0585c63c..073a336e 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -864,12 +864,12 @@ static bool find_prev(const Buffer& buffer, const BufferIterator& pos, if (pos != buffer.begin() and regex_search<BufferIterator, MatchDirection::Backward>( buffer.begin(), pos, matches, ex, - match_flags(buffer, buffer.begin(), pos))) + match_flags(buffer, buffer.begin(), pos) | RegexExecFlags::NotInitialNull)) return true; wrapped = true; return regex_search<BufferIterator, MatchDirection::Backward>( buffer.begin(), buffer.end(), matches, ex, - match_flags(buffer, buffer.begin(), buffer.end())); + match_flags(buffer, buffer.begin(), buffer.end()) | RegexExecFlags::NotInitialNull); } template<MatchDirection direction> @@ -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, utf8::previous(pos, buffer.begin()), matches, regex, wrapped); + : find_prev(buffer, pos, matches, regex, wrapped); if (not found or matches[0].first == buffer.end()) throw runtime_error(format("'{}': no matches found", regex.str())); |
