From 3160618834636a7e02a4108fb203cc314314e17f Mon Sep 17 00:00:00 2001 From: bdomanski Date: Fri, 22 Nov 2019 16:21:51 -0500 Subject: [PATCH 1/2] Fixed backward search from end of word - Searching with 'N' after /e at the end of search fixed - Changed comparison for next search result - Change made in getNextSearchMatchRange in searchState.ts --- src/state/searchState.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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), From 85436db6c5152571443f262ebc36bdbd52f8dde1 Mon Sep 17 00:00:00 2001 From: bdomanski Date: Sun, 24 Nov 2019 13:23:30 -0500 Subject: [PATCH 2/2] Regression test for fixed searching functionality - Searches '/two/e' then types 'N' and checks cursor moved accordingly --- test/mode/normalModeTests/motions.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) 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