From 1ba458ea821b9a39a2cf5eb388f81e4db4763207 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 8 Apr 2017 12:25:18 -0700 Subject: fixing cloze bug --- ext/fg/js/util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/fg') diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js index 445efa5b..e5705ffd 100644 --- a/ext/fg/js/util.js +++ b/ext/fg/js/util.js @@ -182,7 +182,7 @@ function docSentenceExtract(source, extent) { quoteStack = []; - let endPos = content.length - 1; + let endPos = content.length; for (let i = position; i <= endPos; ++i) { const c = content[i]; @@ -205,7 +205,7 @@ function docSentenceExtract(source, extent) { } const text = content.substring(startPos, endPos); - const padding = text.length - text.replace(/^\s+/, ''); + const padding = text.length - text.replace(/^\s+/, '').length; return { text: text.trim(), -- cgit v1.2.3