@codemirror/state 6.1.3 → 6.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +14 -16
- package/dist/index.js +14 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -3362,23 +3362,24 @@ class RangeSet {
|
|
|
3362
3362
|
*/
|
|
3363
3363
|
minPointSize = -1) {
|
|
3364
3364
|
let cursor = new SpanCursor(sets, null, minPointSize).goto(from), pos = from;
|
|
3365
|
-
let
|
|
3365
|
+
let openRanges = cursor.openStart;
|
|
3366
3366
|
for (;;) {
|
|
3367
3367
|
let curTo = Math.min(cursor.to, to);
|
|
3368
3368
|
if (cursor.point) {
|
|
3369
|
-
|
|
3370
|
-
|
|
3369
|
+
let active = cursor.activeForPoint(cursor.to);
|
|
3370
|
+
let openCount = cursor.pointFrom < from ? active.length + 1 : Math.min(active.length, openRanges);
|
|
3371
|
+
iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank);
|
|
3372
|
+
openRanges = Math.min(cursor.openEnd(curTo), active.length);
|
|
3371
3373
|
}
|
|
3372
3374
|
else if (curTo > pos) {
|
|
3373
|
-
iterator.span(pos, curTo, cursor.active,
|
|
3374
|
-
|
|
3375
|
+
iterator.span(pos, curTo, cursor.active, openRanges);
|
|
3376
|
+
openRanges = cursor.openEnd(curTo);
|
|
3375
3377
|
}
|
|
3376
3378
|
if (cursor.to > to)
|
|
3377
|
-
|
|
3379
|
+
return openRanges + (cursor.point && cursor.to > to ? 1 : 0);
|
|
3378
3380
|
pos = cursor.to;
|
|
3379
3381
|
cursor.next();
|
|
3380
3382
|
}
|
|
3381
|
-
return open;
|
|
3382
3383
|
}
|
|
3383
3384
|
/**
|
|
3384
3385
|
Create a range set for the given range or array of ranges. By
|
|
@@ -3682,6 +3683,8 @@ class SpanCursor {
|
|
|
3682
3683
|
this.pointRank = 0;
|
|
3683
3684
|
this.to = -1000000000 /* C.Far */;
|
|
3684
3685
|
this.endSide = 0;
|
|
3686
|
+
// The amount of open active ranges at the start of the iterator.
|
|
3687
|
+
// Not including points.
|
|
3685
3688
|
this.openStart = -1;
|
|
3686
3689
|
this.cursor = HeapCursor.from(sets, skip, minPoint);
|
|
3687
3690
|
}
|
|
@@ -3722,7 +3725,7 @@ class SpanCursor {
|
|
|
3722
3725
|
next() {
|
|
3723
3726
|
let from = this.to, wasPoint = this.point;
|
|
3724
3727
|
this.point = null;
|
|
3725
|
-
let trackOpen = this.openStart < 0 ? [] : null
|
|
3728
|
+
let trackOpen = this.openStart < 0 ? [] : null;
|
|
3726
3729
|
for (;;) {
|
|
3727
3730
|
let a = this.minActive;
|
|
3728
3731
|
if (a > -1 && (this.activeTo[a] - this.cursor.from || this.active[a].endSide - this.cursor.startSide) < 0) {
|
|
@@ -3748,8 +3751,6 @@ class SpanCursor {
|
|
|
3748
3751
|
let nextVal = this.cursor.value;
|
|
3749
3752
|
if (!nextVal.point) { // Opening a range
|
|
3750
3753
|
this.addActive(trackOpen);
|
|
3751
|
-
if (this.cursor.from < from && this.cursor.to > from)
|
|
3752
|
-
trackExtra++;
|
|
3753
3754
|
this.cursor.next();
|
|
3754
3755
|
}
|
|
3755
3756
|
else if (wasPoint && this.cursor.to == this.to && this.cursor.from < this.cursor.to) {
|
|
@@ -3762,8 +3763,6 @@ class SpanCursor {
|
|
|
3762
3763
|
this.pointRank = this.cursor.rank;
|
|
3763
3764
|
this.to = this.cursor.to;
|
|
3764
3765
|
this.endSide = nextVal.endSide;
|
|
3765
|
-
if (this.cursor.from < from)
|
|
3766
|
-
trackExtra = 1;
|
|
3767
3766
|
this.cursor.next();
|
|
3768
3767
|
this.forward(this.to, this.endSide);
|
|
3769
3768
|
break;
|
|
@@ -3771,10 +3770,9 @@ class SpanCursor {
|
|
|
3771
3770
|
}
|
|
3772
3771
|
}
|
|
3773
3772
|
if (trackOpen) {
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
openStart++;
|
|
3777
|
-
this.openStart = openStart + trackExtra;
|
|
3773
|
+
this.openStart = 0;
|
|
3774
|
+
for (let i = trackOpen.length - 1; i >= 0 && trackOpen[i] < from; i--)
|
|
3775
|
+
this.openStart++;
|
|
3778
3776
|
}
|
|
3779
3777
|
}
|
|
3780
3778
|
activeForPoint(to) {
|
package/dist/index.js
CHANGED
|
@@ -3356,23 +3356,24 @@ class RangeSet {
|
|
|
3356
3356
|
*/
|
|
3357
3357
|
minPointSize = -1) {
|
|
3358
3358
|
let cursor = new SpanCursor(sets, null, minPointSize).goto(from), pos = from;
|
|
3359
|
-
let
|
|
3359
|
+
let openRanges = cursor.openStart;
|
|
3360
3360
|
for (;;) {
|
|
3361
3361
|
let curTo = Math.min(cursor.to, to);
|
|
3362
3362
|
if (cursor.point) {
|
|
3363
|
-
|
|
3364
|
-
|
|
3363
|
+
let active = cursor.activeForPoint(cursor.to);
|
|
3364
|
+
let openCount = cursor.pointFrom < from ? active.length + 1 : Math.min(active.length, openRanges);
|
|
3365
|
+
iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank);
|
|
3366
|
+
openRanges = Math.min(cursor.openEnd(curTo), active.length);
|
|
3365
3367
|
}
|
|
3366
3368
|
else if (curTo > pos) {
|
|
3367
|
-
iterator.span(pos, curTo, cursor.active,
|
|
3368
|
-
|
|
3369
|
+
iterator.span(pos, curTo, cursor.active, openRanges);
|
|
3370
|
+
openRanges = cursor.openEnd(curTo);
|
|
3369
3371
|
}
|
|
3370
3372
|
if (cursor.to > to)
|
|
3371
|
-
|
|
3373
|
+
return openRanges + (cursor.point && cursor.to > to ? 1 : 0);
|
|
3372
3374
|
pos = cursor.to;
|
|
3373
3375
|
cursor.next();
|
|
3374
3376
|
}
|
|
3375
|
-
return open;
|
|
3376
3377
|
}
|
|
3377
3378
|
/**
|
|
3378
3379
|
Create a range set for the given range or array of ranges. By
|
|
@@ -3676,6 +3677,8 @@ class SpanCursor {
|
|
|
3676
3677
|
this.pointRank = 0;
|
|
3677
3678
|
this.to = -1000000000 /* C.Far */;
|
|
3678
3679
|
this.endSide = 0;
|
|
3680
|
+
// The amount of open active ranges at the start of the iterator.
|
|
3681
|
+
// Not including points.
|
|
3679
3682
|
this.openStart = -1;
|
|
3680
3683
|
this.cursor = HeapCursor.from(sets, skip, minPoint);
|
|
3681
3684
|
}
|
|
@@ -3716,7 +3719,7 @@ class SpanCursor {
|
|
|
3716
3719
|
next() {
|
|
3717
3720
|
let from = this.to, wasPoint = this.point;
|
|
3718
3721
|
this.point = null;
|
|
3719
|
-
let trackOpen = this.openStart < 0 ? [] : null
|
|
3722
|
+
let trackOpen = this.openStart < 0 ? [] : null;
|
|
3720
3723
|
for (;;) {
|
|
3721
3724
|
let a = this.minActive;
|
|
3722
3725
|
if (a > -1 && (this.activeTo[a] - this.cursor.from || this.active[a].endSide - this.cursor.startSide) < 0) {
|
|
@@ -3742,8 +3745,6 @@ class SpanCursor {
|
|
|
3742
3745
|
let nextVal = this.cursor.value;
|
|
3743
3746
|
if (!nextVal.point) { // Opening a range
|
|
3744
3747
|
this.addActive(trackOpen);
|
|
3745
|
-
if (this.cursor.from < from && this.cursor.to > from)
|
|
3746
|
-
trackExtra++;
|
|
3747
3748
|
this.cursor.next();
|
|
3748
3749
|
}
|
|
3749
3750
|
else if (wasPoint && this.cursor.to == this.to && this.cursor.from < this.cursor.to) {
|
|
@@ -3756,8 +3757,6 @@ class SpanCursor {
|
|
|
3756
3757
|
this.pointRank = this.cursor.rank;
|
|
3757
3758
|
this.to = this.cursor.to;
|
|
3758
3759
|
this.endSide = nextVal.endSide;
|
|
3759
|
-
if (this.cursor.from < from)
|
|
3760
|
-
trackExtra = 1;
|
|
3761
3760
|
this.cursor.next();
|
|
3762
3761
|
this.forward(this.to, this.endSide);
|
|
3763
3762
|
break;
|
|
@@ -3765,10 +3764,9 @@ class SpanCursor {
|
|
|
3765
3764
|
}
|
|
3766
3765
|
}
|
|
3767
3766
|
if (trackOpen) {
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
openStart++;
|
|
3771
|
-
this.openStart = openStart + trackExtra;
|
|
3767
|
+
this.openStart = 0;
|
|
3768
|
+
for (let i = trackOpen.length - 1; i >= 0 && trackOpen[i] < from; i--)
|
|
3769
|
+
this.openStart++;
|
|
3772
3770
|
}
|
|
3773
3771
|
}
|
|
3774
3772
|
activeForPoint(to) {
|