@codemirror/state 6.5.0 → 6.5.1

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.5.1 (2025-01-10)
2
+
3
+ ### Bug fixes
4
+
5
+ `countColumn` no longer loops infinitely when given a `to` that's higher than the input string's length.
6
+
1
7
  ## 6.5.0 (2024-12-09)
2
8
 
3
9
  ### New features
package/dist/index.cjs CHANGED
@@ -3846,7 +3846,7 @@ taking extending characters and tab size into account.
3846
3846
  */
3847
3847
  function countColumn(string, tabSize, to = string.length) {
3848
3848
  let n = 0;
3849
- for (let i = 0; i < to;) {
3849
+ for (let i = 0; i < to && i < string.length;) {
3850
3850
  if (string.charCodeAt(i) == 9) {
3851
3851
  n += tabSize - (n % tabSize);
3852
3852
  i++;
package/dist/index.d.cts CHANGED
@@ -99,6 +99,9 @@ declare abstract class Text implements Iterable<string> {
99
99
  objects that it is made up of. For leaf nodes, this holds null.
100
100
  */
101
101
  abstract readonly children: readonly Text[] | null;
102
+ /**
103
+ @hide
104
+ */
102
105
  [Symbol.iterator]: () => Iterator<string>;
103
106
  /**
104
107
  Create a `Text` instance for the given array of lines.
package/dist/index.d.ts CHANGED
@@ -99,6 +99,9 @@ declare abstract class Text implements Iterable<string> {
99
99
  objects that it is made up of. For leaf nodes, this holds null.
100
100
  */
101
101
  abstract readonly children: readonly Text[] | null;
102
+ /**
103
+ @hide
104
+ */
102
105
  [Symbol.iterator]: () => Iterator<string>;
103
106
  /**
104
107
  Create a `Text` instance for the given array of lines.
package/dist/index.js CHANGED
@@ -3842,7 +3842,7 @@ taking extending characters and tab size into account.
3842
3842
  */
3843
3843
  function countColumn(string, tabSize, to = string.length) {
3844
3844
  let n = 0;
3845
- for (let i = 0; i < to;) {
3845
+ for (let i = 0; i < to && i < string.length;) {
3846
3846
  if (string.charCodeAt(i) == 9) {
3847
3847
  n += tabSize - (n % tabSize);
3848
3848
  i++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/state",
3
- "version": "6.5.0",
3
+ "version": "6.5.1",
4
4
  "description": "Editor state data structures for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",