Actually use lookahead option now

This commit is contained in:
Alex Yatskov 2016-04-06 22:02:49 -07:00
parent 0acc0ad90c
commit fcd27179da
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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;
}