fix buggy extent detection

This commit is contained in:
Alex Yatskov 2017-05-25 09:09:15 -07:00
parent 992852d3c0
commit 9aeb807d4b

View File

@ -160,6 +160,11 @@ function docSentenceExtract(source, extent) {
for (let i = position; i >= startPos; --i) { for (let i = position; i >= startPos; --i) {
const c = content[i]; const c = content[i];
if (c === '\n') {
startPos = i + 1;
break;
}
if (quoteStack.length === 0 && (terminators.includes(c) || c in quotesFwd)) { if (quoteStack.length === 0 && (terminators.includes(c) || c in quotesFwd)) {
startPos = i + 1; startPos = i + 1;
break; break;
@ -178,6 +183,11 @@ function docSentenceExtract(source, extent) {
for (let i = position; i <= endPos; ++i) { for (let i = position; i <= endPos; ++i) {
const c = content[i]; const c = content[i];
if (c === '\n') {
endPos = i + 1;
break;
}
if (quoteStack.length === 0) { if (quoteStack.length === 0) {
if (terminators.includes(c)) { if (terminators.includes(c)) {
endPos = i + 1; endPos = i + 1;