aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/util.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-04-08 12:25:18 -0700
committerAlex Yatskov <alex@foosoft.net>2017-04-08 12:25:18 -0700
commit1ba458ea821b9a39a2cf5eb388f81e4db4763207 (patch)
tree463b010ee19ba24558841a1d840f9011b4f74c6f /ext/fg/js/util.js
parentc4b1a4a5b4811d7aaa70b3b83f740c9e3d2b86be (diff)
fixing cloze bug
Diffstat (limited to 'ext/fg/js/util.js')
-rw-r--r--ext/fg/js/util.js4
1 files changed, 2 insertions, 2 deletions
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(),