@codemirror/language 6.10.0 → 6.10.2
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 +12 -0
- package/dist/index.cjs +14 -6
- package/dist/index.js +14 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 6.10.2 (2024-06-03)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix an infinite loop that could occur when enabling `bidiIsolates` in documents with both bidirectional text and very long lines.
|
|
6
|
+
|
|
7
|
+
## 6.10.1 (2024-02-02)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
Fix an issue where, when a lot of code is visible in the initial editor, the bottom bit of code is shown without highlighting for one frame.
|
|
12
|
+
|
|
1
13
|
## 6.10.0 (2023-12-28)
|
|
2
14
|
|
|
3
15
|
### New features
|
package/dist/index.cjs
CHANGED
|
@@ -1751,16 +1751,20 @@ class TreeHighlighter {
|
|
|
1751
1751
|
this.markCache = Object.create(null);
|
|
1752
1752
|
this.tree = syntaxTree(view.state);
|
|
1753
1753
|
this.decorations = this.buildDeco(view, getHighlighters(view.state));
|
|
1754
|
+
this.decoratedTo = view.viewport.to;
|
|
1754
1755
|
}
|
|
1755
1756
|
update(update) {
|
|
1756
1757
|
let tree = syntaxTree(update.state), highlighters = getHighlighters(update.state);
|
|
1757
1758
|
let styleChange = highlighters != getHighlighters(update.startState);
|
|
1758
|
-
|
|
1759
|
+
let { viewport } = update.view, decoratedToMapped = update.changes.mapPos(this.decoratedTo, 1);
|
|
1760
|
+
if (tree.length < viewport.to && !styleChange && tree.type == this.tree.type && decoratedToMapped >= viewport.to) {
|
|
1759
1761
|
this.decorations = this.decorations.map(update.changes);
|
|
1762
|
+
this.decoratedTo = decoratedToMapped;
|
|
1760
1763
|
}
|
|
1761
1764
|
else if (tree != this.tree || update.viewportChanged || styleChange) {
|
|
1762
1765
|
this.tree = tree;
|
|
1763
1766
|
this.decorations = this.buildDeco(update.view, highlighters);
|
|
1767
|
+
this.decoratedTo = viewport.to;
|
|
1764
1768
|
}
|
|
1765
1769
|
}
|
|
1766
1770
|
buildDeco(view$1, highlighters) {
|
|
@@ -2568,7 +2572,7 @@ const isolateMarks = view.ViewPlugin.fromClass(class {
|
|
|
2568
2572
|
view$1.state.facet(view.EditorView.perLineTextDirection);
|
|
2569
2573
|
this.hasRTL = !this.always && textHasRTL(view$1.state.doc);
|
|
2570
2574
|
this.tree = syntaxTree(view$1.state);
|
|
2571
|
-
this.decorations = buildDeco(view$1, this.tree, this.always);
|
|
2575
|
+
this.decorations = this.always || this.hasRTL ? buildDeco(view$1, this.tree, this.always) : view.Decoration.none;
|
|
2572
2576
|
}
|
|
2573
2577
|
update(update) {
|
|
2574
2578
|
let always = update.state.facet(alwaysIsolate) ||
|
|
@@ -2615,9 +2619,13 @@ function buildDeco(view, tree, always) {
|
|
|
2615
2619
|
function clipRTLLines(ranges, doc) {
|
|
2616
2620
|
let cur = doc.iter(), pos = 0, result = [], last = null;
|
|
2617
2621
|
for (let { from, to } of ranges) {
|
|
2618
|
-
if (
|
|
2619
|
-
|
|
2620
|
-
|
|
2622
|
+
if (last && last.to > from) {
|
|
2623
|
+
from = last.to;
|
|
2624
|
+
if (from >= to)
|
|
2625
|
+
continue;
|
|
2626
|
+
}
|
|
2627
|
+
if (pos + cur.value.length < from) {
|
|
2628
|
+
cur.next(from - (pos + cur.value.length));
|
|
2621
2629
|
pos = from;
|
|
2622
2630
|
}
|
|
2623
2631
|
for (;;) {
|
|
@@ -2628,7 +2636,7 @@ function clipRTLLines(ranges, doc) {
|
|
|
2628
2636
|
else
|
|
2629
2637
|
result.push(last = { from: start, to: Math.min(to, end) });
|
|
2630
2638
|
}
|
|
2631
|
-
if (
|
|
2639
|
+
if (end >= to)
|
|
2632
2640
|
break;
|
|
2633
2641
|
pos = end;
|
|
2634
2642
|
cur.next();
|
package/dist/index.js
CHANGED
|
@@ -1749,16 +1749,20 @@ class TreeHighlighter {
|
|
|
1749
1749
|
this.markCache = Object.create(null);
|
|
1750
1750
|
this.tree = syntaxTree(view.state);
|
|
1751
1751
|
this.decorations = this.buildDeco(view, getHighlighters(view.state));
|
|
1752
|
+
this.decoratedTo = view.viewport.to;
|
|
1752
1753
|
}
|
|
1753
1754
|
update(update) {
|
|
1754
1755
|
let tree = syntaxTree(update.state), highlighters = getHighlighters(update.state);
|
|
1755
1756
|
let styleChange = highlighters != getHighlighters(update.startState);
|
|
1756
|
-
|
|
1757
|
+
let { viewport } = update.view, decoratedToMapped = update.changes.mapPos(this.decoratedTo, 1);
|
|
1758
|
+
if (tree.length < viewport.to && !styleChange && tree.type == this.tree.type && decoratedToMapped >= viewport.to) {
|
|
1757
1759
|
this.decorations = this.decorations.map(update.changes);
|
|
1760
|
+
this.decoratedTo = decoratedToMapped;
|
|
1758
1761
|
}
|
|
1759
1762
|
else if (tree != this.tree || update.viewportChanged || styleChange) {
|
|
1760
1763
|
this.tree = tree;
|
|
1761
1764
|
this.decorations = this.buildDeco(update.view, highlighters);
|
|
1765
|
+
this.decoratedTo = viewport.to;
|
|
1762
1766
|
}
|
|
1763
1767
|
}
|
|
1764
1768
|
buildDeco(view, highlighters) {
|
|
@@ -2566,7 +2570,7 @@ const isolateMarks = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
2566
2570
|
view.state.facet(EditorView.perLineTextDirection);
|
|
2567
2571
|
this.hasRTL = !this.always && textHasRTL(view.state.doc);
|
|
2568
2572
|
this.tree = syntaxTree(view.state);
|
|
2569
|
-
this.decorations = buildDeco(view, this.tree, this.always);
|
|
2573
|
+
this.decorations = this.always || this.hasRTL ? buildDeco(view, this.tree, this.always) : Decoration.none;
|
|
2570
2574
|
}
|
|
2571
2575
|
update(update) {
|
|
2572
2576
|
let always = update.state.facet(alwaysIsolate) ||
|
|
@@ -2613,9 +2617,13 @@ function buildDeco(view, tree, always) {
|
|
|
2613
2617
|
function clipRTLLines(ranges, doc) {
|
|
2614
2618
|
let cur = doc.iter(), pos = 0, result = [], last = null;
|
|
2615
2619
|
for (let { from, to } of ranges) {
|
|
2616
|
-
if (
|
|
2617
|
-
|
|
2618
|
-
|
|
2620
|
+
if (last && last.to > from) {
|
|
2621
|
+
from = last.to;
|
|
2622
|
+
if (from >= to)
|
|
2623
|
+
continue;
|
|
2624
|
+
}
|
|
2625
|
+
if (pos + cur.value.length < from) {
|
|
2626
|
+
cur.next(from - (pos + cur.value.length));
|
|
2619
2627
|
pos = from;
|
|
2620
2628
|
}
|
|
2621
2629
|
for (;;) {
|
|
@@ -2626,7 +2634,7 @@ function clipRTLLines(ranges, doc) {
|
|
|
2626
2634
|
else
|
|
2627
2635
|
result.push(last = { from: start, to: Math.min(to, end) });
|
|
2628
2636
|
}
|
|
2629
|
-
if (
|
|
2637
|
+
if (end >= to)
|
|
2630
2638
|
break;
|
|
2631
2639
|
pos = end;
|
|
2632
2640
|
cur.next();
|