diff --git a/src/cmPlugin.ts b/src/cmPlugin.ts index 7d33186..dfc8675 100644 --- a/src/cmPlugin.ts +++ b/src/cmPlugin.ts @@ -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; @@ -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); @@ -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) {