@codemirror/view 6.39.1 → 6.39.3

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,15 @@
1
+ ## 6.39.3 (2025-12-11)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug that could corrupt the rendered document in some situations involving adjacent mark decorations of the same type.
6
+
7
+ ## 6.39.2 (2025-12-09)
8
+
9
+ ### Bug fixes
10
+
11
+ Fix an issue where `moveVertially` was sometimes unable to escape lines with thick borders or padding.
12
+
1
13
  ## 6.39.1 (2025-12-09)
2
14
 
3
15
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -2649,6 +2649,7 @@ class TileUpdate {
2649
2649
  else if (tile instanceof MarkTile) {
2650
2650
  this.builder.addMark(tile, activeMarks, openMarks);
2651
2651
  this.cache.reused.set(tile, 1 /* Reused.Full */);
2652
+ openMarks = activeMarks.length;
2652
2653
  }
2653
2654
  else {
2654
2655
  return false;
@@ -2661,10 +2662,8 @@ class TileUpdate {
2661
2662
  }
2662
2663
  else {
2663
2664
  this.cache.add(tile);
2664
- if (tile instanceof MarkTile) {
2665
+ if (tile instanceof MarkTile)
2665
2666
  activeMarks.unshift(tile.mark);
2666
- openMarks++;
2667
- }
2668
2667
  }
2669
2668
  this.openWidget = false;
2670
2669
  },
@@ -3707,15 +3706,22 @@ function posAtCoords(view, coords, precise, scanY) {
3707
3706
  let content = view.contentDOM.getBoundingClientRect(), docTop = content.top + view.viewState.paddingTop;
3708
3707
  let { x, y } = coords, yOffset = y - docTop, block;
3709
3708
  // First find the block at the given Y position, if any. If scanY is
3710
- // given (used for vertical cursor motion), try to skip widgets.
3709
+ // given (used for vertical cursor motion), try to skip widgets and
3710
+ // line padding.
3711
3711
  for (;;) {
3712
3712
  if (yOffset < 0)
3713
3713
  return new PosAssoc(0, 1);
3714
3714
  if (yOffset > view.viewState.docHeight)
3715
3715
  return new PosAssoc(view.state.doc.length, -1);
3716
3716
  block = view.elementAtHeight(yOffset);
3717
- if (scanY == null || block.type == exports.BlockType.Text)
3717
+ if (scanY == null)
3718
3718
  break;
3719
+ if (block.type == exports.BlockType.Text) {
3720
+ // Check whether we aren't landing the top/bottom padding of the line
3721
+ let rect = view.docView.coordsAt(scanY < 0 ? block.from : block.to, scanY);
3722
+ if (rect && (scanY < 0 ? rect.top <= yOffset + docTop : rect.bottom >= yOffset + docTop))
3723
+ break;
3724
+ }
3719
3725
  let halfLine = view.viewState.heightOracle.textHeight / 2;
3720
3726
  yOffset = scanY > 0 ? block.bottom + halfLine : block.top - halfLine;
3721
3727
  }
package/dist/index.js CHANGED
@@ -2645,6 +2645,7 @@ class TileUpdate {
2645
2645
  else if (tile instanceof MarkTile) {
2646
2646
  this.builder.addMark(tile, activeMarks, openMarks);
2647
2647
  this.cache.reused.set(tile, 1 /* Reused.Full */);
2648
+ openMarks = activeMarks.length;
2648
2649
  }
2649
2650
  else {
2650
2651
  return false;
@@ -2657,10 +2658,8 @@ class TileUpdate {
2657
2658
  }
2658
2659
  else {
2659
2660
  this.cache.add(tile);
2660
- if (tile instanceof MarkTile) {
2661
+ if (tile instanceof MarkTile)
2661
2662
  activeMarks.unshift(tile.mark);
2662
- openMarks++;
2663
- }
2664
2663
  }
2665
2664
  this.openWidget = false;
2666
2665
  },
@@ -3703,15 +3702,22 @@ function posAtCoords(view, coords, precise, scanY) {
3703
3702
  let content = view.contentDOM.getBoundingClientRect(), docTop = content.top + view.viewState.paddingTop;
3704
3703
  let { x, y } = coords, yOffset = y - docTop, block;
3705
3704
  // First find the block at the given Y position, if any. If scanY is
3706
- // given (used for vertical cursor motion), try to skip widgets.
3705
+ // given (used for vertical cursor motion), try to skip widgets and
3706
+ // line padding.
3707
3707
  for (;;) {
3708
3708
  if (yOffset < 0)
3709
3709
  return new PosAssoc(0, 1);
3710
3710
  if (yOffset > view.viewState.docHeight)
3711
3711
  return new PosAssoc(view.state.doc.length, -1);
3712
3712
  block = view.elementAtHeight(yOffset);
3713
- if (scanY == null || block.type == BlockType.Text)
3713
+ if (scanY == null)
3714
3714
  break;
3715
+ if (block.type == BlockType.Text) {
3716
+ // Check whether we aren't landing the top/bottom padding of the line
3717
+ let rect = view.docView.coordsAt(scanY < 0 ? block.from : block.to, scanY);
3718
+ if (rect && (scanY < 0 ? rect.top <= yOffset + docTop : rect.bottom >= yOffset + docTop))
3719
+ break;
3720
+ }
3715
3721
  let halfLine = view.viewState.heightOracle.textHeight / 2;
3716
3722
  yOffset = scanY > 0 ? block.bottom + halfLine : block.top - halfLine;
3717
3723
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.39.1",
3
+ "version": "6.39.3",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",