Very small optimization.
MODIFY
lib/buffer-search.js
lib/buffer-search.js
@@ -106,10 +106,9 @@ class BufferSearch {
for (let i = 0, n = markers.length; i < n; i++) {
const marker = markers[i]
const bufferRange = marker.getBufferRange();
- let replacementText = findRegex ?
- this.editor.getTextInBufferRange(bufferRange).replace(findRegex, replacePattern) :
- replacePattern;
- replacementText = preserveCaseOnReplace ? Util.preserveCase(replacementText, this.editor.getTextInBufferRange(bufferRange)): replacementText
+ const replacedText = this.editor.getTextInBufferRange(bufferRange)
+ let replacementText = findRegex ? replacedText.replace(findRegex, replacePattern) : replacePattern;
+ replacementText = preserveCaseOnReplace ? Util.preserveCase(replacementText, replacedText): replacementText
this.editor.setTextInBufferRange(bufferRange, replacementText);
marker.destroy();

Very small optimization.