     range
   else
     selection.collapseToStart() if selection.type == "Range"
-    range = selection.getRangeAt 0
+    selection.getRangeAt 0
 
 findModeSaveSelection = ->
   findModeInitialRange = getCurrentRange()

  selection.addRange range

window.enterFindMode = ->
  findModeSaveSelection()
  findModeQuery = { rawQuery: "" }
  findMode = true

  settings.set("findModeRawQuery", findModeQuery.rawQuery)

performFindInPlace = ->
  # Restore the selection.  That way, we're always searching forward from the same place, so we find the right
  # match as the user adds matching characters, or removes previously-matched characters. See #1434.
  findModeRestoreSelection()
  query = if findModeQuery.isRegex then getNextQueryFromRegexMatches(0) else findModeQuery.parsedQuery
  findModeQueryHasResults = executeFind(query, { caseSensitive: !findModeQuery.ignoreCase })
