@codemirror/rangeset
Advanced tools
Comparing version 0.19.0 to 0.19.1
@@ -0,1 +1,7 @@ | ||
## 0.19.1 (2021-08-20) | ||
### Bug fixes | ||
Fix a bug in range set iteration that would sometimes cause ranges to report their position as NaN, breaking downstream code. | ||
## 0.19.0 (2021-08-11) | ||
@@ -2,0 +8,0 @@ |
@@ -526,6 +526,7 @@ import { MapMode } from '@codemirror/state'; | ||
} | ||
let rangeIndex = this.chunkIndex == this.layer.chunk.length ? 0 | ||
: this.layer.chunk[this.chunkIndex].findIndex(pos - this.layer.chunkPos[this.chunkIndex], side, true); | ||
if (!forward || this.rangeIndex < rangeIndex) | ||
this.rangeIndex = rangeIndex; | ||
if (this.chunkIndex < this.layer.chunk.length) { | ||
let rangeIndex = this.layer.chunk[this.chunkIndex].findIndex(pos - this.layer.chunkPos[this.chunkIndex], side, true); | ||
if (!forward || this.rangeIndex < rangeIndex) | ||
this.setRangeIndex(rangeIndex); | ||
} | ||
this.next(); | ||
@@ -550,10 +551,3 @@ } | ||
this.value = chunk.value[this.rangeIndex]; | ||
if (++this.rangeIndex == chunk.value.length) { | ||
this.chunkIndex++; | ||
if (this.skip) { | ||
while (this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex])) | ||
this.chunkIndex++; | ||
} | ||
this.rangeIndex = 0; | ||
} | ||
this.setRangeIndex(this.rangeIndex + 1); | ||
if (this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint) | ||
@@ -564,2 +558,15 @@ break; | ||
} | ||
setRangeIndex(index) { | ||
if (index == this.layer.chunk[this.chunkIndex].value.length) { | ||
this.chunkIndex++; | ||
if (this.skip) { | ||
while (this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex])) | ||
this.chunkIndex++; | ||
} | ||
this.rangeIndex = 0; | ||
} | ||
else { | ||
this.rangeIndex = index; | ||
} | ||
} | ||
nextChunk() { | ||
@@ -566,0 +573,0 @@ this.chunkIndex++; |
{ | ||
"name": "@codemirror/rangeset", | ||
"version": "0.19.0", | ||
"version": "0.19.1", | ||
"description": "Range set data structure for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73033
1915