diff --git a/src/selectors.hh b/src/selectors.hh index 8e61a151..2f638216 100644 --- a/src/selectors.hh +++ b/src/selectors.hh @@ -274,8 +274,7 @@ Selection find_next_match(const Buffer& buffer, const Selection& sel, const Rege CaptureList captures; MatchResults matches; bool found = false; - auto pos = direction == Forward ? utf8::next(begin, buffer.end()) - : utf8::previous(begin, buffer.begin()); + auto pos = direction == Forward ? utf8::next(begin, buffer.end()) : begin; if ((found = find_match_in_buffer(buffer, pos, matches, regex))) { begin = ensure_char_start(buffer, matches[0].first); diff --git a/test/compose/backward-search/cmd b/test/compose/backward-search/cmd new file mode 100644 index 00000000..233d5449 --- /dev/null +++ b/test/compose/backward-search/cmd @@ -0,0 +1 @@ +xxx diff --git a/test/compose/backward-search/in b/test/compose/backward-search/in new file mode 100644 index 00000000..7bc61746 --- /dev/null +++ b/test/compose/backward-search/in @@ -0,0 +1 @@ +xxx%(y)yyxxx diff --git a/test/compose/backward-search/state b/test/compose/backward-search/state new file mode 100644 index 00000000..ed36bb39 --- /dev/null +++ b/test/compose/backward-search/state @@ -0,0 +1 @@ +1.1,1.3