     super()
 
   toggleFocus: =>
-    if @hasClass('replace-mode') and @findEditor.find(':focus').length > 0
+    if @findEditor.find(':focus').length > 0
       @replaceEditor.focus()
     else
       @findEditor.focus()

    atom.rootView.command 'find-and-replace:replace-all', @replaceAll

  showFind: =>
    if not @hasParent()
      @attach()
      @addClass('find-mode').removeClass('replace-mode')
    @findEditor.focus()
    @findEditor.selectAll()

  showReplace: =>
    @attach()
    @addClass('replace-mode').removeClass('find-mode')
    @replaceEditor.redraw()
    @replaceEditor.focus()
    @replaceEditor.selectAll()

  serialize: ->
    findHistory: @findHistory.serialize()
    replaceHistory: @replaceHistory.serialize()
    modelState: @findModel.serialize()

  handleEvents: ->
