 
 class FindMode extends Mode
   constructor: (@options = {}) ->
+    # Save the selection, so performFindInPlace can restore it.
+    findModeSaveSelection()
+    window.findModeQuery = rawQuery: ""
     if @options.returnToViewport
       @scrollX = window.scrollX
       @scrollY = window.scrollY

      name: "find"
      indicator: false
      exitOnClick: true

  exit: (event) ->
    super()

# Enters find mode.  Returns the new find-mode instance.
window.enterFindMode = (options = {}) ->
  Marks.setPreviousPosition()
  window.findMode = new FindMode options

window.showHelpDialog = (html, fid) ->
  return if (isShowingHelpDialog || !document.body || fid != frameId)
