From 337644921567e415b933874d84ec8b5e9415cb0d Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Wed, 3 Jun 2015 00:24:11 +0100 Subject: Inline findModeSaveSelection, store initialRange in FindMode instance --- content_scripts/vimium_frontend.coffee | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 5c1d5c6f..b8bf9ef3 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -9,7 +9,6 @@ window.findModeQuery = { rawQuery: "", matchCount: 0 } window.findMode = null window.findModeQueryHasResults = false findModeAnchorNode = null -findModeInitialRange = null isShowingHelpDialog = false keyPort = null isEnabledForUrl = true @@ -691,7 +690,7 @@ window.handleEnterForFindMode = -> class FindMode extends Mode constructor: (@options = {}) -> # Save the selection, so performFindInPlace can restore it. - findModeSaveSelection() + @initialRange = getCurrentRange() window.findModeQuery = rawQuery: "" if @options.returnToViewport @scrollX = window.scrollX @@ -913,10 +912,8 @@ getCurrentRange = -> selection.collapseToStart() if selection.type == "Range" selection.getRangeAt 0 -findModeSaveSelection = -> - findModeInitialRange = getCurrentRange() - -findModeRestoreSelection = (range = findModeInitialRange) -> +findModeRestoreSelection = -> + range = findMode.initialRange selection = getSelection() selection.removeAllRanges() selection.addRange range -- cgit v1.2.3