@codemirror/view 6.43.5 → 6.43.7

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,21 @@
1
+ ## 6.43.7 (2026-07-27)
2
+
3
+ ### Bug fixes
4
+
5
+ Make the panel container top/bottom style a regular rule, rather than an inline style.
6
+
7
+ Fix an issue where widgets changing length could break content updates.
8
+
9
+ Fix incorrectly drawn selection when a line wrap point lies between widgets.
10
+
11
+ Work around regression in Firefox 153 breaking selection hiding.
12
+
13
+ ## 6.43.6 (2026-07-06)
14
+
15
+ ### Bug fixes
16
+
17
+ Fix another tile tree corruption bug that could occur on zero-length content updates.
18
+
1
19
  ## 6.43.5 (2026-07-04)
2
20
 
3
21
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -1970,6 +1970,9 @@ class LineTile extends CompositeTile {
1970
1970
  }
1971
1971
  get domAttrs() { return this.attrs; }
1972
1972
  // Find the tile associated with a given position in this line.
1973
+ // Side -2/2 is handled specially, in that it allows the position
1974
+ // returned to be before (-2) or after (2) widgets that would always
1975
+ // be after/before a cursor position.
1973
1976
  resolveInline(pos, side, forCoords) {
1974
1977
  let before = null, beforeOff = -1, after = null, afterOff = -1;
1975
1978
  function scan(tile, pos) {
@@ -1980,11 +1983,11 @@ class LineTile extends CompositeTile {
1980
1983
  scan(child, pos - off);
1981
1984
  }
1982
1985
  else if ((!after || after.isHidden && (side > 0 && !(after.flags & 32 /* TileFlag.After */) || forCoords && onSameLine(after, child))) &&
1983
- (end > pos || (child.flags & 32 /* TileFlag.After */))) {
1986
+ (end > pos || (child.flags & 32 /* TileFlag.After */) && side <= 1)) {
1984
1987
  after = child;
1985
1988
  afterOff = pos - off;
1986
1989
  }
1987
- else if (off < pos || (child.flags & 16 /* TileFlag.Before */) && !child.isHidden) {
1990
+ else if (off < pos || (child.flags & 16 /* TileFlag.Before */) && !child.isHidden && side >= -1) {
1988
1991
  before = child;
1989
1992
  beforeOff = pos - off;
1990
1993
  }
@@ -2190,7 +2193,15 @@ class TilePointer {
2190
2193
  let { tile, index, beforeBreak, parents } = this;
2191
2194
  while (dist || side > 0) {
2192
2195
  if (!tile.isComposite()) {
2193
- if (index == tile.length) {
2196
+ let len = tile.length;
2197
+ if (index < len && dist) {
2198
+ let take = Math.min(dist, len - index);
2199
+ if (walker)
2200
+ walker.skip(tile, index, index + take);
2201
+ dist -= take;
2202
+ index += take;
2203
+ }
2204
+ if (index == len) {
2194
2205
  beforeBreak = !!tile.breakAfter;
2195
2206
  ({ tile, index } = parents.pop());
2196
2207
  index++;
@@ -2198,13 +2209,6 @@ class TilePointer {
2198
2209
  else if (!dist) {
2199
2210
  break;
2200
2211
  }
2201
- else {
2202
- let take = Math.min(dist, tile.length - index);
2203
- if (walker)
2204
- walker.skip(tile, index, index + take);
2205
- dist -= take;
2206
- index += take;
2207
- }
2208
2212
  }
2209
2213
  else if (beforeBreak) {
2210
2214
  if (!dist)
@@ -2738,7 +2742,7 @@ class TileUpdate {
2738
2742
  }
2739
2743
  emit(from, to) {
2740
2744
  let pendingLineAttrs = null;
2741
- let b = this.builder, markCount = 0;
2745
+ let b = this.builder, markCount = -1;
2742
2746
  let openEnd = state.RangeSet.spans(this.decorations, from, to, {
2743
2747
  point: (from, to, deco, active, openStart, index) => {
2744
2748
  if (deco instanceof PointDecoration) {
@@ -2792,7 +2796,8 @@ class TileUpdate {
2792
2796
  markCount = active.length;
2793
2797
  }
2794
2798
  });
2795
- this.openWidget = openEnd > markCount;
2799
+ if (markCount > -1)
2800
+ this.openWidget = openEnd > markCount;
2796
2801
  if (!this.openWidget)
2797
2802
  b.addLineStartIfNotCovered(pendingLineAttrs);
2798
2803
  this.openMarks = openEnd;
@@ -6982,6 +6987,8 @@ const baseTheme$1 = buildTheme("." + baseThemeID, {
6982
6987
  backgroundColor: "#f5f5f5",
6983
6988
  color: "black"
6984
6989
  },
6990
+ ".cm-panels-top": { top: "0" },
6991
+ ".cm-panels-bottom": { bottom: "0" },
6985
6992
  "&light .cm-panels-top": {
6986
6993
  borderBottom: "1px solid #ddd"
6987
6994
  },
@@ -9590,9 +9597,10 @@ const selectionLayer = layer({
9590
9597
  },
9591
9598
  class: "cm-selectionLayer"
9592
9599
  });
9600
+ const selectionBg = browser.gecko && browser.gecko_version >= 153 ? "#ffffff01" : "transparent";
9593
9601
  const hideNativeSelection = state.Prec.highest(EditorView.theme({
9594
9602
  ".cm-line": {
9595
- "& ::selection, &::selection": { backgroundColor: "transparent !important" },
9603
+ "& ::selection, &::selection": { backgroundColor: `${selectionBg} !important` },
9596
9604
  caretColor: "transparent !important"
9597
9605
  },
9598
9606
  ".cm-content": {
@@ -11103,7 +11111,6 @@ class PanelGroup {
11103
11111
  if (!this.dom) {
11104
11112
  this.dom = document.createElement("div");
11105
11113
  this.dom.className = this.top ? "cm-panels cm-panels-top" : "cm-panels cm-panels-bottom";
11106
- this.dom.style[this.top ? "top" : "bottom"] = "0";
11107
11114
  let parent = this.container || this.view.dom;
11108
11115
  parent.insertBefore(this.dom, this.top ? parent.firstChild : null);
11109
11116
  }
package/dist/index.js CHANGED
@@ -1966,6 +1966,9 @@ class LineTile extends CompositeTile {
1966
1966
  }
1967
1967
  get domAttrs() { return this.attrs; }
1968
1968
  // Find the tile associated with a given position in this line.
1969
+ // Side -2/2 is handled specially, in that it allows the position
1970
+ // returned to be before (-2) or after (2) widgets that would always
1971
+ // be after/before a cursor position.
1969
1972
  resolveInline(pos, side, forCoords) {
1970
1973
  let before = null, beforeOff = -1, after = null, afterOff = -1;
1971
1974
  function scan(tile, pos) {
@@ -1976,11 +1979,11 @@ class LineTile extends CompositeTile {
1976
1979
  scan(child, pos - off);
1977
1980
  }
1978
1981
  else if ((!after || after.isHidden && (side > 0 && !(after.flags & 32 /* TileFlag.After */) || forCoords && onSameLine(after, child))) &&
1979
- (end > pos || (child.flags & 32 /* TileFlag.After */))) {
1982
+ (end > pos || (child.flags & 32 /* TileFlag.After */) && side <= 1)) {
1980
1983
  after = child;
1981
1984
  afterOff = pos - off;
1982
1985
  }
1983
- else if (off < pos || (child.flags & 16 /* TileFlag.Before */) && !child.isHidden) {
1986
+ else if (off < pos || (child.flags & 16 /* TileFlag.Before */) && !child.isHidden && side >= -1) {
1984
1987
  before = child;
1985
1988
  beforeOff = pos - off;
1986
1989
  }
@@ -2186,7 +2189,15 @@ class TilePointer {
2186
2189
  let { tile, index, beforeBreak, parents } = this;
2187
2190
  while (dist || side > 0) {
2188
2191
  if (!tile.isComposite()) {
2189
- if (index == tile.length) {
2192
+ let len = tile.length;
2193
+ if (index < len && dist) {
2194
+ let take = Math.min(dist, len - index);
2195
+ if (walker)
2196
+ walker.skip(tile, index, index + take);
2197
+ dist -= take;
2198
+ index += take;
2199
+ }
2200
+ if (index == len) {
2190
2201
  beforeBreak = !!tile.breakAfter;
2191
2202
  ({ tile, index } = parents.pop());
2192
2203
  index++;
@@ -2194,13 +2205,6 @@ class TilePointer {
2194
2205
  else if (!dist) {
2195
2206
  break;
2196
2207
  }
2197
- else {
2198
- let take = Math.min(dist, tile.length - index);
2199
- if (walker)
2200
- walker.skip(tile, index, index + take);
2201
- dist -= take;
2202
- index += take;
2203
- }
2204
2208
  }
2205
2209
  else if (beforeBreak) {
2206
2210
  if (!dist)
@@ -2734,7 +2738,7 @@ class TileUpdate {
2734
2738
  }
2735
2739
  emit(from, to) {
2736
2740
  let pendingLineAttrs = null;
2737
- let b = this.builder, markCount = 0;
2741
+ let b = this.builder, markCount = -1;
2738
2742
  let openEnd = RangeSet.spans(this.decorations, from, to, {
2739
2743
  point: (from, to, deco, active, openStart, index) => {
2740
2744
  if (deco instanceof PointDecoration) {
@@ -2788,7 +2792,8 @@ class TileUpdate {
2788
2792
  markCount = active.length;
2789
2793
  }
2790
2794
  });
2791
- this.openWidget = openEnd > markCount;
2795
+ if (markCount > -1)
2796
+ this.openWidget = openEnd > markCount;
2792
2797
  if (!this.openWidget)
2793
2798
  b.addLineStartIfNotCovered(pendingLineAttrs);
2794
2799
  this.openMarks = openEnd;
@@ -6977,6 +6982,8 @@ const baseTheme$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
6977
6982
  backgroundColor: "#f5f5f5",
6978
6983
  color: "black"
6979
6984
  },
6985
+ ".cm-panels-top": { top: "0" },
6986
+ ".cm-panels-bottom": { bottom: "0" },
6980
6987
  "&light .cm-panels-top": {
6981
6988
  borderBottom: "1px solid #ddd"
6982
6989
  },
@@ -9585,9 +9592,10 @@ const selectionLayer = /*@__PURE__*/layer({
9585
9592
  },
9586
9593
  class: "cm-selectionLayer"
9587
9594
  });
9595
+ const selectionBg = browser.gecko && browser.gecko_version >= 153 ? "#ffffff01" : "transparent";
9588
9596
  const hideNativeSelection = /*@__PURE__*/Prec.highest(/*@__PURE__*/EditorView.theme({
9589
9597
  ".cm-line": {
9590
- "& ::selection, &::selection": { backgroundColor: "transparent !important" },
9598
+ "& ::selection, &::selection": { backgroundColor: `${selectionBg} !important` },
9591
9599
  caretColor: "transparent !important"
9592
9600
  },
9593
9601
  ".cm-content": {
@@ -11098,7 +11106,6 @@ class PanelGroup {
11098
11106
  if (!this.dom) {
11099
11107
  this.dom = document.createElement("div");
11100
11108
  this.dom.className = this.top ? "cm-panels cm-panels-top" : "cm-panels cm-panels-bottom";
11101
- this.dom.style[this.top ? "top" : "bottom"] = "0";
11102
11109
  let parent = this.container || this.view.dom;
11103
11110
  parent.insertBefore(this.dom, this.top ? parent.firstChild : null);
11104
11111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.43.5",
3
+ "version": "6.43.7",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",