diff options
| author | Stephen Blott | 2015-01-16 16:01:03 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-01-16 16:01:03 +0000 |
| commit | 41a2c5a3f77a15b2ad5f386f1a2a194df49d107d (patch) | |
| tree | 6b2e8b07259ee3819f4a0d8e6e567a01a89f14fb | |
| parent | 0f80b22ca3a072d843cc79eeae71312a5b2eee74 (diff) | |
| download | vimium-41a2c5a3f77a15b2ad5f386f1a2a194df49d107d.tar.bz2 | |
Use selection.collapseToStart() for performFindInPlace().
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index a3ab051b..ddedb1ef 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -702,18 +702,10 @@ handleEnterForFindMode = -> settings.set("findModeRawQuery", findModeQuery.rawQuery) performFindInPlace = -> - cachedScrollX = window.scrollX - cachedScrollY = window.scrollY - query = if findModeQuery.isRegex then getNextQueryFromRegexMatches(0) else findModeQuery.parsedQuery - # Search backwards first to "free up" the current word as eligible for the real forward search. This allows - # us to search in place without jumping around between matches as the query grows. - executeFind(query, { backwards: true, caseSensitive: !findModeQuery.ignoreCase }) - - # We need to restore the scroll position because we might've lost the right position by searching - # backwards. - window.scrollTo(cachedScrollX, cachedScrollY) + selection = window.getSelection() + selection.collapseToStart() if selection.type == "Range" findModeQueryHasResults = executeFind(query, { caseSensitive: !findModeQuery.ignoreCase }) |
