summaryrefslogtreecommitdiff
path: root/ext/fg/js/source.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-06 19:34:32 -0400
committerGitHub <noreply@github.com>2020-05-06 19:34:32 -0400
commitd6ae3229614fb11fee799387d17347ea97509c59 (patch)
tree795e9ba8b5c198a44a5ca5d8c346dbf0e46a54c0 /ext/fg/js/source.js
parentf7df6254d6f71d5331b000dcbd27271bd2c3006f (diff)
Text scanning update (#507)
* Fix unity test missing a parameter * Update docSentenceExtract to not rescan content
Diffstat (limited to 'ext/fg/js/source.js')
-rw-r--r--ext/fg/js/source.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/fg/js/source.js b/ext/fg/js/source.js
index b3119d40..c9d70215 100644
--- a/ext/fg/js/source.js
+++ b/ext/fg/js/source.js
@@ -46,10 +46,14 @@ class TextSourceRange {
return this.content;
}
- setEndOffset(length) {
- const state = TextSourceRange.seekForward(this.range.startContainer, this.range.startOffset, length);
+ setEndOffset(length, fromEnd=false) {
+ const state = (
+ fromEnd ?
+ TextSourceRange.seekForward(this.range.endContainer, this.range.endOffset, length) :
+ TextSourceRange.seekForward(this.range.startContainer, this.range.startOffset, length)
+ );
this.range.setEnd(state.node, state.offset);
- this.content = state.content;
+ this.content = (fromEnd ? this.content + state.content : state.content);
return length - state.remainder;
}