@codemirror/state 6.7.3 → 6.7.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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## 6.7.4 (2026-09-04)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix the sorting of point ranges when mapping collapses points to the same position.
6
+
1
7
  ## 6.7.3 (2026-09-04)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -3141,13 +3141,15 @@ class Chunk {
3141
3141
  }
3142
3142
  else {
3143
3143
  if (newFrom == newTo) { // Try to reorder points to fit in here
3144
- for (let i = value.length - 1; i > 0; i--) {
3145
- if ((newFrom - to[i - 1] || val.startSide - value[i - 1].endSide) <= 0) {
3144
+ for (let i = value.length; i > 0; i--) {
3145
+ if ((newFrom - (to[i - 1] + newPos) || val.startSide - value[i - 1].endSide) >= 0) {
3146
3146
  value.splice(i, 0, val);
3147
- from.splice(i, 0, newFrom);
3148
- to.splice(i, 0, newTo);
3147
+ from.splice(i, 0, newFrom - newPos);
3148
+ to.splice(i, 0, newTo - newPos);
3149
3149
  continue iter;
3150
3150
  }
3151
+ if ((newFrom - (from[i - 1] + newPos) || val.endSide - value[i - 1].startSide) > 0)
3152
+ break;
3151
3153
  }
3152
3154
  }
3153
3155
  // Otherwise, spill into a new layer
package/dist/index.js CHANGED
@@ -3137,13 +3137,15 @@ class Chunk {
3137
3137
  }
3138
3138
  else {
3139
3139
  if (newFrom == newTo) { // Try to reorder points to fit in here
3140
- for (let i = value.length - 1; i > 0; i--) {
3141
- if ((newFrom - to[i - 1] || val.startSide - value[i - 1].endSide) <= 0) {
3140
+ for (let i = value.length; i > 0; i--) {
3141
+ if ((newFrom - (to[i - 1] + newPos) || val.startSide - value[i - 1].endSide) >= 0) {
3142
3142
  value.splice(i, 0, val);
3143
- from.splice(i, 0, newFrom);
3144
- to.splice(i, 0, newTo);
3143
+ from.splice(i, 0, newFrom - newPos);
3144
+ to.splice(i, 0, newTo - newPos);
3145
3145
  continue iter;
3146
3146
  }
3147
+ if ((newFrom - (from[i - 1] + newPos) || val.endSide - value[i - 1].startSide) > 0)
3148
+ break;
3147
3149
  }
3148
3150
  }
3149
3151
  // Otherwise, spill into a new layer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/state",
3
- "version": "6.7.3",
3
+ "version": "6.7.4",
4
4
  "description": "Editor state data structures for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",