summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseenxu <seen_xu@msn.com>2020-12-29 22:03:24 +0100
committerJack Rosenthal <jack@rosenth.al>2021-01-06 16:47:14 -0700
commit4749f95d1ce07f95cd64bb028e9f9fdd1f7f6bd0 (patch)
tree801abacc714ca83242b7fbdefcf3aba9a257c9de
parentafb7054cdd8aae8ffaf842fff0db14c4551d32fc (diff)
downloadpentadactyl-4749f95d1ce07f95cd64bb028e9f9fdd1f7f6bd0.tar.gz
fix issue #9, match got stucked on text input which is the root cause of highlight find browser hangs
-rw-r--r--common/modules/finder.jsm19
1 files changed, 16 insertions, 3 deletions
diff --git a/common/modules/finder.jsm b/common/modules/finder.jsm
index 90745ee0..e21e3348 100644
--- a/common/modules/finder.jsm
+++ b/common/modules/finder.jsm
@@ -669,9 +669,22 @@ var RangeFind = Class("RangeFind", {
}
this.range = this.ranges[i];
- let start = RangeFind.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ?
- RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) :
- RangeFind.endpoint(this.range.range, !this.backward);
+ let is_same_doc = RangeFind.sameDocument(
+ this.lastRange, this.range.range);
+ let is_intersected = this.range.intersects(this.lastRange);
+ let start = null;
+ if (is_same_doc && is_intersected) {
+ start = RangeFind.endpoint(
+ this.lastRange, !(again ^ this.backward));
+ } else {
+ if (this.range == null || this.lastRange == null) {
+ start = RangeFind.endpoint(
+ this.range.range, !this.backward);
+ } else {
+ start = RangeFind.endpoint(
+ this.lastRange, this.backward);
+ }
+ }
if (this.backward && !again)
start = RangeFind.endpoint(this.startRange, false);