aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-05-25 09:09:15 -0700
committerAlex Yatskov <alex@foosoft.net>2017-05-25 09:09:15 -0700
commit9aeb807d4b40717f0eef50de9b456ddaa08fbadd (patch)
tree68bc08735af360200e9788f054d639f6f73d7923 /ext/fg/js
parent992852d3c0aab94044e4a850f598bed38dbc2579 (diff)
fix buggy extent detection
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/util.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js
index a9e67976..c6270ce6 100644
--- a/ext/fg/js/util.js
+++ b/ext/fg/js/util.js
@@ -160,6 +160,11 @@ function docSentenceExtract(source, extent) {
for (let i = position; i >= startPos; --i) {
const c = content[i];
+ if (c === '\n') {
+ startPos = i + 1;
+ break;
+ }
+
if (quoteStack.length === 0 && (terminators.includes(c) || c in quotesFwd)) {
startPos = i + 1;
break;
@@ -178,6 +183,11 @@ function docSentenceExtract(source, extent) {
for (let i = position; i <= endPos; ++i) {
const c = content[i];
+ if (c === '\n') {
+ endPos = i + 1;
+ break;
+ }
+
if (quoteStack.length === 0) {
if (terminators.includes(c)) {
endPos = i + 1;