 
   updateOptionsLabel: ->
     label = []
-    label.push('Regex') if @findModel.getFindOptions().useRegex
-    if @findModel.getFindOptions().caseSensitive
+    label.push('Regex') if @model.getFindOptions().useRegex
+    if @model.getFindOptions().caseSensitive
       label.push('Case Sensitive')
     else
       label.push('Case Insensitive')
-    label.push('Within Current Selection') if @findModel.getFindOptions().inCurrentSelection
-    label.push('Whole Word') if @findModel.getFindOptions().wholeWord
+    label.push('Within Current Selection') if @model.getFindOptions().inCurrentSelection
+    label.push('Whole Word') if @model.getFindOptions().wholeWord
     @optionsLabel.text(label.join(', '))
 
   updateOptionButtons: ->
-    @setOptionButtonState(@regexOptionButton, @findModel.getFindOptions().useRegex)
-    @setOptionButtonState(@caseOptionButton, @findModel.getFindOptions().caseSensitive)
-    @setOptionButtonState(@selectionOptionButton, @findModel.getFindOptions().inCurrentSelection)
-    @setOptionButtonState(@wholeWordOptionButton, @findModel.getFindOptions().wholeWord)
+    @setOptionButtonState(@regexOptionButton, @model.getFindOptions().useRegex)
+    @setOptionButtonState(@caseOptionButton, @model.getFindOptions().caseSensitive)
+    @setOptionButtonState(@selectionOptionButton, @model.getFindOptions().inCurrentSelection)
+    @setOptionButtonState(@wholeWordOptionButton, @model.getFindOptions().wholeWord)
 
   setOptionButtonState: (optionButton, selected) ->
     if selected

      optionButton.removeClass 'selected'

  toggleRegexOption: =>
    @updateModel {findPattern: @findEditor.getText(), useRegex: not @findModel.getFindOptions().useRegex}
    @selectFirstMarkerAfterCursor()

  toggleCaseOption: =>
    @updateModel {findPattern: @findEditor.getText(), caseSensitive: not @findModel.getFindOptions().caseSensitive}
    @selectFirstMarkerAfterCursor()

  toggleSelectionOption: =>
    @updateModel {findPattern: @findEditor.getText(), inCurrentSelection: not @findModel.getFindOptions().inCurrentSelection}
    @selectFirstMarkerAfterCursor()

  toggleWholeWordOption: =>
    @updateModel {findPattern: @findEditor.getText(), wholeWord: not @findModel.getFindOptions().wholeWord}
    @selectFirstMarkerAfterCursor()

  updateReplaceEnablement: ->

    @selectMarkerAtIndex(markerIndex)

  firstMarkerIndexAfterCursor: (indexIncluded=false) ->
    editor = @model.getEditor()
    return -1 unless editor

    selection = editor.getLastSelection()
