From 0e5f769166076d33ea1a2c0e00bf4d02d301d2d7 Mon Sep 17 00:00:00 2001 From: FelisDiligens <47528453+FelisDiligens@users.noreply.github.com> Date: Fri, 10 Feb 2023 07:23:46 +0100 Subject: [PATCH] Fix 'findPrevious' --- src/cmPlugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmPlugin.ts b/src/cmPlugin.ts index dfc8675..81ea7e9 100644 --- a/src/cmPlugin.ts +++ b/src/cmPlugin.ts @@ -137,7 +137,7 @@ function findPrevious(context, cm: Editor, form) { return; // Get editor and cursor: - let cursor: Position = replace ? cm.getCursor("to") : cm.getCursor("from"); + let cursor: Position = cm.getCursor("from"); let firstPos: Position = firstLineAndCh(); let lastPos: Position = lastLineAndCh(cm); @@ -174,7 +174,7 @@ function findPrevious(context, cm: Editor, form) { } // Select the text that has been found: - let newSelection = getMatchRange(content, match.index, replace ? form.replacement.length : match.length, contentStart); + let newSelection = getMatchRange(content, match.index, match.length, contentStart); cm.setSelection(newSelection.from, newSelection.to); // Needed for the cursor to be visible: