aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJames Maa <jmaa@berkeley.edu>2024-06-11 19:26:57 -0700
committerGitHub <noreply@github.com>2024-06-12 02:26:57 +0000
commit0ade97639757f15979193013640cf73ee41ff420 (patch)
treecd72e43e05741be3d40f9fe711ba3b8695ee6fe4 /ext
parentcd5ff5397390691cb737ad9db1581eb6fd8f6899 (diff)
Fix semantics of disallowExpandSelection (#1051)
* Fix semantics of disallowExpandSelection * Missed one
Diffstat (limited to 'ext')
-rw-r--r--ext/js/dom/text-source-range.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/js/dom/text-source-range.js b/ext/js/dom/text-source-range.js
index 4a6f5e2f..7fd9fb69 100644
--- a/ext/js/dom/text-source-range.js
+++ b/ext/js/dom/text-source-range.js
@@ -150,7 +150,7 @@ export class TextSourceRange {
const state = new DOMTextScanner(node, offset, !layoutAwareScan, layoutAwareScan).seek(length);
this._range.setEnd(state.node, state.offset);
const expandedContent = fromEnd ? this._content + state.content : state.content;
- this._content = this._disallowExpandSelection ? expandedContent : this._content;
+ this._content = this._disallowExpandSelection ? this._content : expandedContent;
return length - state.remainder;
}
@@ -257,7 +257,7 @@ export class TextSourceRange {
* @returns {TextSourceRange} A new instance of the class corresponding to the range.
*/
static create(range) {
- return new TextSourceRange(range, range.startOffset, range.toString(), null, null, null, null, true);
+ return new TextSourceRange(range, range.startOffset, range.toString(), null, null, null, null, false);
}
/**
@@ -266,7 +266,7 @@ export class TextSourceRange {
* @returns {TextSourceRange} A new instance of the class corresponding to the range.
*/
static createLazy(range) {
- return new TextSourceRange(range, range.startOffset, range.toString(), null, null, null, null, false);
+ return new TextSourceRange(range, range.startOffset, range.toString(), null, null, null, null, true);
}
/**
@@ -279,7 +279,7 @@ export class TextSourceRange {
static createFromImposter(range, imposterElement, imposterSourceElement) {
const cachedRects = convertMultipleRectZoomCoordinates(range.getClientRects(), range.startContainer);
const cachedSourceRect = convertRectZoomCoordinates(imposterSourceElement.getBoundingClientRect(), imposterSourceElement);
- return new TextSourceRange(range, range.startOffset, range.toString(), imposterElement, imposterSourceElement, cachedRects, cachedSourceRect, true);
+ return new TextSourceRange(range, range.startOffset, range.toString(), imposterElement, imposterSourceElement, cachedRects, cachedSourceRect, false);
}
/**