Fix error when editing with an invalid regex search
MODIFY
lib/buffer-search.js
lib/buffer-search.js
@@ -223,7 +223,7 @@ class BufferSearch {
scanEnd = Point.INFINITY;
}
- const newMarkers = this.createMarkers(scanStart, scanEnd);
+ const newMarkers = this.createMarkers(scanStart, scanEnd) || [];
const oldMarkers = this.markers.splice(spliceStart, (spliceEnd - spliceStart) + 1, ...newMarkers);
for (let oldMarker of oldMarkers) {
oldMarker.destroy();

MODIFY
spec/find-view-spec.coffee
spec/find-view-spec.coffee
@@ -1232,6 +1232,9 @@ describe 'FindView', ->
findView.findEditor.setText '('
atom.commands.dispatch(findView.findEditor.element, 'find-and-replace:toggle-regex-option')
+ editor.insertText('hi')
+ advanceClock(editor.getBuffer().stoppedChangingDelay)
+
describe "replacing", ->
beforeEach ->
editor.setCursorBufferPosition([2, 0])

Fix error when editing with an invalid regex search