@opentui/core 0.1.33 → 0.1.34

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/index.js CHANGED
@@ -134,7 +134,7 @@ import {
134
134
  white,
135
135
  wrapWithDelegates,
136
136
  yellow
137
- } from "./index-xqg0a6ka.js";
137
+ } from "./index-x37wckj8.js";
138
138
  // src/text-buffer-view.ts
139
139
  class TextBufferView {
140
140
  lib;
@@ -2664,6 +2664,7 @@ class CodeRenderable extends TextBufferRenderable {
2664
2664
  _currentHighlightId = 0;
2665
2665
  _conceal;
2666
2666
  _drawUnstyledText;
2667
+ _shouldRenderTextBuffer = true;
2667
2668
  _contentDefaultOptions = {
2668
2669
  content: "",
2669
2670
  conceal: true,
@@ -2724,6 +2725,15 @@ class CodeRenderable extends TextBufferRenderable {
2724
2725
  this.scheduleUpdate();
2725
2726
  }
2726
2727
  }
2728
+ get treeSitterClient() {
2729
+ return this._treeSitterClient;
2730
+ }
2731
+ set treeSitterClient(value) {
2732
+ if (this._treeSitterClient !== value) {
2733
+ this._treeSitterClient = value;
2734
+ this.scheduleUpdate();
2735
+ }
2736
+ }
2727
2737
  scheduleUpdate() {
2728
2738
  if (this._pendingUpdate)
2729
2739
  return;
@@ -2738,12 +2748,14 @@ class CodeRenderable extends TextBufferRenderable {
2738
2748
  return;
2739
2749
  if (!this._filetype) {
2740
2750
  this.fallback(content);
2751
+ this._shouldRenderTextBuffer = true;
2741
2752
  return;
2742
2753
  }
2743
2754
  this._currentHighlightId++;
2744
2755
  const highlightId = this._currentHighlightId;
2745
- if (this._drawUnstyledText) {
2746
- this.fallback(content);
2756
+ this.fallback(content);
2757
+ if (!this._drawUnstyledText) {
2758
+ this._shouldRenderTextBuffer = false;
2747
2759
  }
2748
2760
  this._isHighlighting = true;
2749
2761
  this._pendingRehighlight = false;
@@ -2757,6 +2769,7 @@ class CodeRenderable extends TextBufferRenderable {
2757
2769
  if (this.isDestroyed)
2758
2770
  return;
2759
2771
  this.textBuffer.setStyledText(styledText);
2772
+ this._shouldRenderTextBuffer = true;
2760
2773
  this.updateTextInfo();
2761
2774
  } catch (error) {
2762
2775
  if (highlightId !== this._currentHighlightId) {
@@ -2764,6 +2777,7 @@ class CodeRenderable extends TextBufferRenderable {
2764
2777
  }
2765
2778
  console.warn("Code highlighting failed, falling back to plain text:", error);
2766
2779
  this.fallback(content);
2780
+ this._shouldRenderTextBuffer = true;
2767
2781
  } finally {
2768
2782
  if (highlightId === this._currentHighlightId) {
2769
2783
  this._isHighlighting = false;
@@ -2792,6 +2806,11 @@ class CodeRenderable extends TextBufferRenderable {
2792
2806
  getLineHighlights(lineIdx) {
2793
2807
  return this.textBuffer.getLineHighlights(lineIdx);
2794
2808
  }
2809
+ renderSelf(buffer) {
2810
+ if (!this._shouldRenderTextBuffer)
2811
+ return;
2812
+ super.renderSelf(buffer);
2813
+ }
2795
2814
  }
2796
2815
  // src/renderables/TextNode.ts
2797
2816
  var BrandedTextNodeRenderable = Symbol.for("@opentui/core/TextNodeRenderable");
@@ -6203,5 +6222,5 @@ export {
6203
6222
  ASCIIFont
6204
6223
  };
6205
6224
 
6206
- //# debugId=1FBC3EC4899A6D8064756E2164756E21
6225
+ //# debugId=451BE98665FD310764756E2164756E21
6207
6226
  //# sourceMappingURL=index.js.map