Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/buffer-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion lib/find-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ class FindView extends View

firstMarkerIndexAfterCursor: (indexIncluded=false) ->
editor = @model.getEditor()
return null unless editor
return null unless editor and @markers?.length > 0

selection = editor.getLastSelection()
{start, end} = selection.getBufferRange()
Expand Down
13 changes: 13 additions & 0 deletions spec/find-view-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,19 @@ describe 'FindView', ->
atom.commands.dispatch(findView.findEditor.element, 'core:confirm')
expect(getResultDecorations(editor, 'find-result')).toHaveLength 0

it "doesn't throw an exception when toggling the regex option with an invalid pattern before performing any other search (regression)", ->
atom.commands.dispatch editorView, 'find-and-replace:show'

waitsForPromise ->
activationPromise

runs ->
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])
Expand Down