aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/mode_find.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-06-13 13:03:10 +0100
committerStephen Blott2015-06-13 13:03:10 +0100
commit4f426affde34c895cf342dac256895ffe98ee4f3 (patch)
tree00e86e7d58c20602a018ae4ff93e6c1b30052287 /content_scripts/mode_find.coffee
parentf34f842417bdac363fac5a3e47366b3ee94c2454 (diff)
downloadvimium-4f426affde34c895cf342dac256895ffe98ee4f3.tar.bz2
Refactor duplicate code.
Diffstat (limited to 'content_scripts/mode_find.coffee')
-rw-r--r--content_scripts/mode_find.coffee5
1 files changed, 4 insertions, 1 deletions
diff --git a/content_scripts/mode_find.coffee b/content_scripts/mode_find.coffee
index 297c4158..bba457b6 100644
--- a/content_scripts/mode_find.coffee
+++ b/content_scripts/mode_find.coffee
@@ -87,7 +87,7 @@ class FindMode extends Mode
findInPlace: (query) ->
# If requested, restore the scroll position (so that failed searches leave the scroll position unchanged).
- window.scrollTo @scrollX, @scrollY if @options.returnToViewport
+ @checkReturnToViewPort()
FindMode.updateQuery query
# 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.
@@ -196,6 +196,9 @@ class FindMode extends Mode
@restoreDefaultSelectionHighlight: -> document.body.classList.remove("vimiumFindMode")
+ checkReturnToViewPort: ->
+ window.scrollTo @scrollX, @scrollY if @options.returnToViewport
+
getCurrentRange = ->
selection = getSelection()
if selection.type == "None"