diff options
| author | mrmr1993 | 2015-06-03 00:24:11 +0100 |
|---|---|---|
| committer | mrmr1993 | 2015-06-10 17:26:52 +0100 |
| commit | 337644921567e415b933874d84ec8b5e9415cb0d (patch) | |
| tree | a17602566bc8a911e2af4b3ed3d01a6126d48b57 | |
| parent | 3b5f9fd40cabeca1843631585356de81d4db92ac (diff) | |
| download | vimium-337644921567e415b933874d84ec8b5e9415cb0d.tar.bz2 | |
Inline findModeSaveSelection, store initialRange in FindMode instance
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 9 |
1 files changed, 3 insertions, 6 deletions
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 |
