Skip to content

Commit

Permalink
Fix 'findPrevious'
Browse files Browse the repository at this point in the history
  • Loading branch information
FelisDiligens committed Feb 10, 2023
1 parent ef5ee11 commit 0e5f769
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 0e5f769

Please sign in to comment.