     @active = false
     view.deactivate() for view in @searchResultsViews
 
-
+  currentEditor: ->
+    rootView.getActiveView()
+
+


  onActiveItemChanged: =>
    return unless window.rootView
    editor = rootView.getActiveView()
    @trigger('active-editor-changed', editor: editor)

  onCursorMoved: =>

  replaceNext: =>
    @search()
    replacement = @replaceEditor.getText()
    @currentEditor().trigger('find-and-replace:replace-next', {replacement})

  replaceAll: =>
    @search()
    replacement = @replaceEditor.getText()
    @currentEditor().trigger('find-and-replace:replace-all', {replacement})

  findPrevious: =>
    @cursorMoveOriginatedHere = true # See HACK above.
    @currentEditor().trigger('find-and-replace:find-previous')

  findNext: =>
    @cursorMoveOriginatedHere = true # See HACK above.
    @currentEditor().trigger('find-and-replace:find-next')

  toggleRegexOption: => @toggleOption('regex')

