aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/mode_find.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-06-13 12:55:01 +0100
committerStephen Blott2015-06-13 12:55:01 +0100
commitc21aa9ab03d5537d575d3c46d3affce7f3ece5e5 (patch)
tree3853a4ed69886cefdcfa36aaf859d1b6dd8f8f9c /content_scripts/mode_find.coffee
parent26a0653318be7bae4254e2e643dcb5ae5e2498e9 (diff)
downloadvimium-c21aa9ab03d5537d575d3c46d3affce7f3ece5e5.tar.bz2
Refactor findInPlace.
This code belongs together, so we put it together.
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 ff9506e7..21918be2 100644
--- a/content_scripts/mode_find.coffee
+++ b/content_scripts/mode_find.coffee
@@ -84,7 +84,10 @@ class FindMode extends Mode
selection.removeAllRanges()
selection.addRange range
- findInPlace: ->
+ findInPlace: (query) ->
+ # If requested, restore the scroll position (so that failed searches leave the scroll position unchanged).
+ window.scrollTo @scrollX, @scrollY if @options.returnToViewport
+ 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.
@restoreSelection()