diff --git a/src/state/searchState.ts b/src/state/searchState.ts index 8646d3e39d4..8d1ebb823ae 100644 --- a/src/state/searchState.ts +++ b/src/state/searchState.ts @@ -325,7 +325,7 @@ export class SearchState { .slice(0) .reverse() .entries()) { - if (matchRange.start.compareTo(startPosition) < 0) { + if (matchRange.end.compareTo(startPosition) <= 0) { return { start: Position.FromVSCodePosition(matchRange.start), end: Position.FromVSCodePosition(matchRange.end), diff --git a/test/mode/normalModeTests/motions.test.ts b/test/mode/normalModeTests/motions.test.ts index 6a0605b49fe..898a1c7ef51 100644 --- a/test/mode/normalModeTests/motions.test.ts +++ b/test/mode/normalModeTests/motions.test.ts @@ -312,6 +312,13 @@ suite('Motions in Normal Mode', () => { end: ['one two |two two'], }); + newTest({ + title: 'Can run a forward and find previous search from end of word', + start: ['|one two one two'], + keysPressed: '/two/e\nN', + end: ['one two one tw|o'], + }); + // These "remembering history between editor" tests have started // breaking. Since I don't remember these tests ever breaking for real, and // because they're the cause of a lot of flaky tests, I'm disabling these for