Skip to content

Commit

Permalink
Removing the unused replace argument from
Browse files Browse the repository at this point in the history
  • Loading branch information
FelisDiligens committed Feb 9, 2023
1 parent b6ab065 commit c8820a9
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/cmPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function findNext(context, cm: Editor, form, replace: boolean) {
cm.focus();
}

function findPrevious(context, cm: Editor, form, replace: boolean) {
function findPrevious(context, cm: Editor, form) {
if (!validate(context, form))
return;

Expand Down Expand Up @@ -173,15 +173,6 @@ function findPrevious(context, cm: Editor, form, replace: boolean) {
return;
}

// Replace the matched text:
if (replace) {
if (form.options.preserveCase)
content = replacePreserveCase(content, regex, prepareReplacement(form.replacement, form.options));
else
content = content.replace(regex, prepareReplacement(form.replacement, form.options));
cm.replaceRange(content, contentStart, contentEnd);
}

// Select the text that has been found:
let newSelection = getMatchRange(content, match.index, replace ? form.replacement.length : match.length, contentStart);
cm.setSelection(newSelection.from, newSelection.to);
Expand Down Expand Up @@ -224,7 +215,7 @@ module.exports = {
});

CodeMirror.defineExtension('SARPlugin.findPrevious', async function(form) {
findPrevious(context, this as Editor, form, false);
findPrevious(context, this as Editor, form);
});

CodeMirror.defineExtension('SARPlugin.replace', async function(form) {
Expand Down

0 comments on commit c8820a9

Please sign in to comment.