From fcd27179daaa1cb4d99cc17f55412852e00dc6a3 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Wed, 6 Apr 2016 22:02:49 -0700 Subject: [PATCH] Actually use lookahead option now --- ext/fg/js/client.js | 2 +- ext/fg/js/util.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js index 3c75068c..d5ad0c2f 100644 --- a/ext/fg/js/client.js +++ b/ext/fg/js/client.js @@ -81,7 +81,7 @@ class Client { } searchAtPoint(point) { - const range = getRangeAtPoint(point, 10); + const range = getRangeAtPoint(point, this.options.scanLength); if (range === null) { this.hidePopup(); return; diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js index eb153e9b..4f4bcbd3 100644 --- a/ext/fg/js/util.js +++ b/ext/fg/js/util.js @@ -17,7 +17,7 @@ */ -function getRangeAtPoint(point, lookAhead) { +function getRangeAtPoint(point, scanLength) { const range = document.caretRangeFromPoint(point.x, point.y); if (range === null) { return null; @@ -29,7 +29,7 @@ function getRangeAtPoint(point, lookAhead) { } const offset = range.startOffset; - const length = Math.min(node.length - offset, lookAhead); + const length = Math.min(node.length - offset, scanLength); if (length === 0) { return null; }