Skip to content

Commit

Permalink
Clear decorations when SearchResults is destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
oggy committed Jan 27, 2019
1 parent 6695a05 commit 8fbf9b8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/search-results.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class SearchResults
@currentDecorations = []

clear: ->
@_clearDecorations()
@markerLayer.clear()
@_numMatches = 0

Expand Down Expand Up @@ -45,10 +46,13 @@ class SearchResults

setCurrent: (markers) ->
# TODO: don't destroy markers that don't need to be destroyed?
@currentDecorations.forEach (decoration) ->
decoration.destroy()
@_clearDecorations()

@currentDecorations = markers.map (marker) =>
@editor.decorateMarker marker,
type: 'highlight'
class: 'atomic-emacs-current-result'

_clearDecorations: ->
@currentDecorations.forEach (decoration) ->
decoration.destroy()

0 comments on commit 8fbf9b8

Please sign in to comment.