@opentui/core 0.1.34 → 0.1.35
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/3d.js +1 -1
- package/{index-x37wckj8.js → index-n8nbvvhk.js} +27 -6
- package/{index-x37wckj8.js.map → index-n8nbvvhk.js.map} +6 -6
- package/index.js +153 -41
- package/index.js.map +8 -8
- package/package.json +7 -7
- package/renderables/Code.d.ts +7 -0
- package/renderables/EditBufferRenderable.d.ts +9 -1
- package/renderables/Input.d.ts +9 -1
- package/renderables/ScrollBox.d.ts +8 -2
- package/renderables/Select.d.ts +4 -1
- package/renderer.d.ts +2 -0
- package/testing.js +1 -1
- package/types.d.ts +4 -0
package/index.js
CHANGED
|
@@ -134,7 +134,7 @@ import {
|
|
|
134
134
|
white,
|
|
135
135
|
wrapWithDelegates,
|
|
136
136
|
yellow
|
|
137
|
-
} from "./index-
|
|
137
|
+
} from "./index-n8nbvvhk.js";
|
|
138
138
|
// src/text-buffer-view.ts
|
|
139
139
|
class TextBufferView {
|
|
140
140
|
lib;
|
|
@@ -2570,10 +2570,7 @@ class TextBufferRenderable extends Renderable {
|
|
|
2570
2570
|
}
|
|
2571
2571
|
updateTextInfo() {
|
|
2572
2572
|
if (this.lastLocalSelection) {
|
|
2573
|
-
|
|
2574
|
-
if (changed) {
|
|
2575
|
-
this.requestRender();
|
|
2576
|
-
}
|
|
2573
|
+
this.updateLocalSelection(this.lastLocalSelection);
|
|
2577
2574
|
}
|
|
2578
2575
|
this.yogaNode.markDirty();
|
|
2579
2576
|
this.requestRender();
|
|
@@ -2636,6 +2633,9 @@ class TextBufferRenderable extends Renderable {
|
|
|
2636
2633
|
this.markClean();
|
|
2637
2634
|
this._ctx.addToHitGrid(this.x, this.y, this.width, this.height, this.num);
|
|
2638
2635
|
this.renderSelf(buffer);
|
|
2636
|
+
if (this.buffered && this.frameBuffer) {
|
|
2637
|
+
buffer.drawFrameBuffer(this.x, this.y, this.frameBuffer);
|
|
2638
|
+
}
|
|
2639
2639
|
}
|
|
2640
2640
|
renderSelf(buffer) {
|
|
2641
2641
|
if (this.textBuffer.ptr) {
|
|
@@ -2665,10 +2665,14 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
2665
2665
|
_conceal;
|
|
2666
2666
|
_drawUnstyledText;
|
|
2667
2667
|
_shouldRenderTextBuffer = true;
|
|
2668
|
+
_streaming;
|
|
2669
|
+
_hadInitialContent = false;
|
|
2670
|
+
_lastHighlights = [];
|
|
2668
2671
|
_contentDefaultOptions = {
|
|
2669
2672
|
content: "",
|
|
2670
2673
|
conceal: true,
|
|
2671
|
-
drawUnstyledText: true
|
|
2674
|
+
drawUnstyledText: true,
|
|
2675
|
+
streaming: false
|
|
2672
2676
|
};
|
|
2673
2677
|
constructor(ctx, options) {
|
|
2674
2678
|
super(ctx, options);
|
|
@@ -2678,6 +2682,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
2678
2682
|
this._treeSitterClient = options.treeSitterClient ?? getTreeSitterClient();
|
|
2679
2683
|
this._conceal = options.conceal ?? this._contentDefaultOptions.conceal;
|
|
2680
2684
|
this._drawUnstyledText = options.drawUnstyledText ?? this._contentDefaultOptions.drawUnstyledText;
|
|
2685
|
+
this._streaming = options.streaming ?? this._contentDefaultOptions.streaming;
|
|
2681
2686
|
this.updateContent(this._content);
|
|
2682
2687
|
}
|
|
2683
2688
|
get content() {
|
|
@@ -2725,6 +2730,17 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
2725
2730
|
this.scheduleUpdate();
|
|
2726
2731
|
}
|
|
2727
2732
|
}
|
|
2733
|
+
get streaming() {
|
|
2734
|
+
return this._streaming;
|
|
2735
|
+
}
|
|
2736
|
+
set streaming(value) {
|
|
2737
|
+
if (this._streaming !== value) {
|
|
2738
|
+
this._streaming = value;
|
|
2739
|
+
this._hadInitialContent = false;
|
|
2740
|
+
this._lastHighlights = [];
|
|
2741
|
+
this.scheduleUpdate();
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2728
2744
|
get treeSitterClient() {
|
|
2729
2745
|
return this._treeSitterClient;
|
|
2730
2746
|
}
|
|
@@ -2753,22 +2769,47 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
2753
2769
|
}
|
|
2754
2770
|
this._currentHighlightId++;
|
|
2755
2771
|
const highlightId = this._currentHighlightId;
|
|
2772
|
+
const isInitialContent = this._streaming && !this._hadInitialContent;
|
|
2773
|
+
if (isInitialContent) {
|
|
2774
|
+
this._hadInitialContent = true;
|
|
2775
|
+
}
|
|
2776
|
+
const shouldDrawUnstyledNow = this._streaming ? isInitialContent && this._drawUnstyledText : this._drawUnstyledText;
|
|
2756
2777
|
this.fallback(content);
|
|
2757
|
-
if (!
|
|
2778
|
+
if (!shouldDrawUnstyledNow) {
|
|
2758
2779
|
this._shouldRenderTextBuffer = false;
|
|
2759
2780
|
}
|
|
2781
|
+
if (this._streaming && !isInitialContent && this._lastHighlights.length > 0) {
|
|
2782
|
+
const chunks = treeSitterToTextChunks(content, this._lastHighlights, this._syntaxStyle, {
|
|
2783
|
+
enabled: this._conceal
|
|
2784
|
+
});
|
|
2785
|
+
const partialStyledText = new StyledText(chunks);
|
|
2786
|
+
if (this.isDestroyed)
|
|
2787
|
+
return;
|
|
2788
|
+
this.textBuffer.setStyledText(partialStyledText);
|
|
2789
|
+
this._shouldRenderTextBuffer = true;
|
|
2790
|
+
this.updateTextInfo();
|
|
2791
|
+
}
|
|
2760
2792
|
this._isHighlighting = true;
|
|
2761
2793
|
this._pendingRehighlight = false;
|
|
2762
2794
|
try {
|
|
2763
|
-
const
|
|
2764
|
-
conceal: { enabled: this._conceal }
|
|
2765
|
-
});
|
|
2795
|
+
const result = await this._treeSitterClient.highlightOnce(content, this._filetype);
|
|
2766
2796
|
if (highlightId !== this._currentHighlightId) {
|
|
2767
2797
|
return;
|
|
2768
2798
|
}
|
|
2769
2799
|
if (this.isDestroyed)
|
|
2770
2800
|
return;
|
|
2771
|
-
|
|
2801
|
+
if (result.highlights && result.highlights.length > 0) {
|
|
2802
|
+
if (this._streaming) {
|
|
2803
|
+
this._lastHighlights = result.highlights;
|
|
2804
|
+
}
|
|
2805
|
+
const chunks = treeSitterToTextChunks(content, result.highlights, this._syntaxStyle, {
|
|
2806
|
+
enabled: this._conceal
|
|
2807
|
+
});
|
|
2808
|
+
const styledText = new StyledText(chunks);
|
|
2809
|
+
this.textBuffer.setStyledText(styledText);
|
|
2810
|
+
} else {
|
|
2811
|
+
this.fallback(content);
|
|
2812
|
+
}
|
|
2772
2813
|
this._shouldRenderTextBuffer = true;
|
|
2773
2814
|
this.updateTextInfo();
|
|
2774
2815
|
} catch (error) {
|
|
@@ -3131,6 +3172,7 @@ class InputRenderable extends Renderable {
|
|
|
3131
3172
|
_focusedTextColor;
|
|
3132
3173
|
_placeholderColor;
|
|
3133
3174
|
_cursorColor;
|
|
3175
|
+
_cursorStyle;
|
|
3134
3176
|
_maxLength;
|
|
3135
3177
|
_lastCommittedValue = "";
|
|
3136
3178
|
_defaultOptions = {
|
|
@@ -3141,6 +3183,10 @@ class InputRenderable extends Renderable {
|
|
|
3141
3183
|
placeholder: "",
|
|
3142
3184
|
placeholderColor: "#666666",
|
|
3143
3185
|
cursorColor: "#FFFFFF",
|
|
3186
|
+
cursorStyle: {
|
|
3187
|
+
style: "block",
|
|
3188
|
+
blinking: true
|
|
3189
|
+
},
|
|
3144
3190
|
maxLength: 1000,
|
|
3145
3191
|
value: ""
|
|
3146
3192
|
};
|
|
@@ -3157,6 +3203,7 @@ class InputRenderable extends Renderable {
|
|
|
3157
3203
|
this._maxLength = options.maxLength || this._defaultOptions.maxLength;
|
|
3158
3204
|
this._placeholderColor = parseColor(options.placeholderColor || this._defaultOptions.placeholderColor);
|
|
3159
3205
|
this._cursorColor = parseColor(options.cursorColor || this._defaultOptions.cursorColor);
|
|
3206
|
+
this._cursorStyle = options.cursorStyle || this._defaultOptions.cursorStyle;
|
|
3160
3207
|
}
|
|
3161
3208
|
updateCursorPosition() {
|
|
3162
3209
|
if (!this._focused)
|
|
@@ -3179,7 +3226,7 @@ class InputRenderable extends Renderable {
|
|
|
3179
3226
|
}
|
|
3180
3227
|
focus() {
|
|
3181
3228
|
super.focus();
|
|
3182
|
-
this._ctx.setCursorStyle(
|
|
3229
|
+
this._ctx.setCursorStyle(this._cursorStyle.style, this._cursorStyle.blinking);
|
|
3183
3230
|
this._ctx.setCursorColor(this._cursorColor);
|
|
3184
3231
|
this.updateCursorPosition();
|
|
3185
3232
|
}
|
|
@@ -3369,7 +3416,21 @@ class InputRenderable extends Renderable {
|
|
|
3369
3416
|
const newColor = parseColor(value ?? this._defaultOptions.cursorColor);
|
|
3370
3417
|
if (this._cursorColor !== newColor) {
|
|
3371
3418
|
this._cursorColor = newColor;
|
|
3372
|
-
this.
|
|
3419
|
+
if (this._focused) {
|
|
3420
|
+
this._ctx.requestRender();
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
get cursorStyle() {
|
|
3425
|
+
return this._cursorStyle;
|
|
3426
|
+
}
|
|
3427
|
+
set cursorStyle(style) {
|
|
3428
|
+
const newStyle = style;
|
|
3429
|
+
if (this.cursorStyle.style !== newStyle.style || this.cursorStyle.blinking !== newStyle.blinking) {
|
|
3430
|
+
this._cursorStyle = newStyle;
|
|
3431
|
+
if (this._focused) {
|
|
3432
|
+
this._ctx.requestRender();
|
|
3433
|
+
}
|
|
3373
3434
|
}
|
|
3374
3435
|
}
|
|
3375
3436
|
updateFromLayout() {
|
|
@@ -3971,12 +4032,23 @@ class ArrowRenderable extends Renderable {
|
|
|
3971
4032
|
// src/renderables/ScrollBox.ts
|
|
3972
4033
|
class ContentRenderable extends BoxRenderable {
|
|
3973
4034
|
viewport;
|
|
3974
|
-
|
|
4035
|
+
_viewportCulling;
|
|
4036
|
+
constructor(ctx, viewport, viewportCulling, options) {
|
|
3975
4037
|
super(ctx, options);
|
|
3976
4038
|
this.viewport = viewport;
|
|
4039
|
+
this._viewportCulling = viewportCulling;
|
|
4040
|
+
}
|
|
4041
|
+
get viewportCulling() {
|
|
4042
|
+
return this._viewportCulling;
|
|
4043
|
+
}
|
|
4044
|
+
set viewportCulling(value) {
|
|
4045
|
+
this._viewportCulling = value;
|
|
3977
4046
|
}
|
|
3978
4047
|
_getChildren() {
|
|
3979
|
-
|
|
4048
|
+
if (this._viewportCulling) {
|
|
4049
|
+
return getObjectsInViewport(this.viewport, this.getChildrenSortedByPrimaryAxis(), this.primaryAxis);
|
|
4050
|
+
}
|
|
4051
|
+
return this.getChildrenSortedByPrimaryAxis();
|
|
3980
4052
|
}
|
|
3981
4053
|
}
|
|
3982
4054
|
|
|
@@ -4108,6 +4180,7 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4108
4180
|
scrollX = false,
|
|
4109
4181
|
scrollY = true,
|
|
4110
4182
|
scrollAcceleration,
|
|
4183
|
+
viewportCulling = true,
|
|
4111
4184
|
...options
|
|
4112
4185
|
}) {
|
|
4113
4186
|
super(ctx, {
|
|
@@ -4143,7 +4216,7 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4143
4216
|
id: `scroll-box-viewport-${this.internalId}`
|
|
4144
4217
|
});
|
|
4145
4218
|
this.wrapper.add(this.viewport);
|
|
4146
|
-
this.content = new ContentRenderable(ctx, this.viewport, {
|
|
4219
|
+
this.content = new ContentRenderable(ctx, this.viewport, viewportCulling, {
|
|
4147
4220
|
alignSelf: "flex-start",
|
|
4148
4221
|
flexShrink: 0,
|
|
4149
4222
|
...scrollX ? { minWidth: "100%" } : { minWidth: "100%", maxWidth: "100%" },
|
|
@@ -4437,6 +4510,13 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4437
4510
|
set scrollAcceleration(value) {
|
|
4438
4511
|
this.scrollAccel = value;
|
|
4439
4512
|
}
|
|
4513
|
+
get viewportCulling() {
|
|
4514
|
+
return this.content.viewportCulling;
|
|
4515
|
+
}
|
|
4516
|
+
set viewportCulling(value) {
|
|
4517
|
+
this.content.viewportCulling = value;
|
|
4518
|
+
this.requestRender();
|
|
4519
|
+
}
|
|
4440
4520
|
destroySelf() {
|
|
4441
4521
|
if (this.selectionListener) {
|
|
4442
4522
|
this._ctx.off("selection", this.selectionListener);
|
|
@@ -4455,7 +4535,7 @@ var SelectRenderableEvents;
|
|
|
4455
4535
|
class SelectRenderable extends Renderable {
|
|
4456
4536
|
_focusable = true;
|
|
4457
4537
|
_options = [];
|
|
4458
|
-
|
|
4538
|
+
_selectedIndex = 0;
|
|
4459
4539
|
scrollOffset = 0;
|
|
4460
4540
|
maxVisibleItems;
|
|
4461
4541
|
_backgroundColor;
|
|
@@ -4481,6 +4561,7 @@ class SelectRenderable extends Renderable {
|
|
|
4481
4561
|
focusedTextColor: "#FFFFFF",
|
|
4482
4562
|
selectedBackgroundColor: "#334455",
|
|
4483
4563
|
selectedTextColor: "#FFFF00",
|
|
4564
|
+
selectedIndex: 0,
|
|
4484
4565
|
descriptionColor: "#888888",
|
|
4485
4566
|
selectedDescriptionColor: "#CCCCCC",
|
|
4486
4567
|
showScrollIndicator: false,
|
|
@@ -4491,11 +4572,13 @@ class SelectRenderable extends Renderable {
|
|
|
4491
4572
|
};
|
|
4492
4573
|
constructor(ctx, options) {
|
|
4493
4574
|
super(ctx, { ...options, buffered: true });
|
|
4575
|
+
this._options = options.options || [];
|
|
4576
|
+
const requestedIndex = options.selectedIndex ?? this._defaultOptions.selectedIndex;
|
|
4577
|
+
this._selectedIndex = this._options.length > 0 ? Math.min(requestedIndex, this._options.length - 1) : 0;
|
|
4494
4578
|
this._backgroundColor = parseColor(options.backgroundColor || this._defaultOptions.backgroundColor);
|
|
4495
4579
|
this._textColor = parseColor(options.textColor || this._defaultOptions.textColor);
|
|
4496
4580
|
this._focusedBackgroundColor = parseColor(options.focusedBackgroundColor || this._defaultOptions.focusedBackgroundColor);
|
|
4497
4581
|
this._focusedTextColor = parseColor(options.focusedTextColor || this._defaultOptions.focusedTextColor);
|
|
4498
|
-
this._options = options.options || [];
|
|
4499
4582
|
this._showScrollIndicator = options.showScrollIndicator ?? this._defaultOptions.showScrollIndicator;
|
|
4500
4583
|
this._wrapSelection = options.wrapSelection ?? this._defaultOptions.wrapSelection;
|
|
4501
4584
|
this._showDescription = options.showDescription ?? this._defaultOptions.showDescription;
|
|
@@ -4532,7 +4615,7 @@ class SelectRenderable extends Renderable {
|
|
|
4532
4615
|
for (let i = 0;i < visibleOptions.length; i++) {
|
|
4533
4616
|
const actualIndex = this.scrollOffset + i;
|
|
4534
4617
|
const option = visibleOptions[i];
|
|
4535
|
-
const isSelected = actualIndex === this.
|
|
4618
|
+
const isSelected = actualIndex === this._selectedIndex;
|
|
4536
4619
|
const itemY = contentY + i * this.linesPerItem;
|
|
4537
4620
|
if (itemY + this.linesPerItem - 1 >= contentY + contentHeight)
|
|
4538
4621
|
break;
|
|
@@ -4573,7 +4656,7 @@ class SelectRenderable extends Renderable {
|
|
|
4573
4656
|
renderScrollIndicatorToFrameBuffer(contentX, contentY, contentWidth, contentHeight) {
|
|
4574
4657
|
if (!this.frameBuffer)
|
|
4575
4658
|
return;
|
|
4576
|
-
const scrollPercent = this.
|
|
4659
|
+
const scrollPercent = this._selectedIndex / Math.max(1, this._options.length - 1);
|
|
4577
4660
|
const indicatorHeight = Math.max(1, contentHeight - 2);
|
|
4578
4661
|
const indicatorY = contentY + 1 + Math.floor(scrollPercent * indicatorHeight);
|
|
4579
4662
|
const indicatorX = contentX + contentWidth - 1;
|
|
@@ -4584,61 +4667,61 @@ class SelectRenderable extends Renderable {
|
|
|
4584
4667
|
}
|
|
4585
4668
|
set options(options) {
|
|
4586
4669
|
this._options = options;
|
|
4587
|
-
this.
|
|
4670
|
+
this._selectedIndex = Math.min(this._selectedIndex, Math.max(0, options.length - 1));
|
|
4588
4671
|
this.updateScrollOffset();
|
|
4589
4672
|
this.requestRender();
|
|
4590
4673
|
}
|
|
4591
4674
|
getSelectedOption() {
|
|
4592
|
-
return this._options[this.
|
|
4675
|
+
return this._options[this._selectedIndex] || null;
|
|
4593
4676
|
}
|
|
4594
4677
|
getSelectedIndex() {
|
|
4595
|
-
return this.
|
|
4678
|
+
return this._selectedIndex;
|
|
4596
4679
|
}
|
|
4597
4680
|
moveUp(steps = 1) {
|
|
4598
|
-
const newIndex = this.
|
|
4681
|
+
const newIndex = this._selectedIndex - steps;
|
|
4599
4682
|
if (newIndex >= 0) {
|
|
4600
|
-
this.
|
|
4683
|
+
this._selectedIndex = newIndex;
|
|
4601
4684
|
} else if (this._wrapSelection && this._options.length > 0) {
|
|
4602
|
-
this.
|
|
4685
|
+
this._selectedIndex = this._options.length - 1;
|
|
4603
4686
|
} else {
|
|
4604
|
-
this.
|
|
4687
|
+
this._selectedIndex = 0;
|
|
4605
4688
|
}
|
|
4606
4689
|
this.updateScrollOffset();
|
|
4607
4690
|
this.requestRender();
|
|
4608
|
-
this.emit("selectionChanged" /* SELECTION_CHANGED */, this.
|
|
4691
|
+
this.emit("selectionChanged" /* SELECTION_CHANGED */, this._selectedIndex, this.getSelectedOption());
|
|
4609
4692
|
}
|
|
4610
4693
|
moveDown(steps = 1) {
|
|
4611
|
-
const newIndex = this.
|
|
4694
|
+
const newIndex = this._selectedIndex + steps;
|
|
4612
4695
|
if (newIndex < this._options.length) {
|
|
4613
|
-
this.
|
|
4696
|
+
this._selectedIndex = newIndex;
|
|
4614
4697
|
} else if (this._wrapSelection && this._options.length > 0) {
|
|
4615
|
-
this.
|
|
4698
|
+
this._selectedIndex = 0;
|
|
4616
4699
|
} else {
|
|
4617
|
-
this.
|
|
4700
|
+
this._selectedIndex = this._options.length - 1;
|
|
4618
4701
|
}
|
|
4619
4702
|
this.updateScrollOffset();
|
|
4620
4703
|
this.requestRender();
|
|
4621
|
-
this.emit("selectionChanged" /* SELECTION_CHANGED */, this.
|
|
4704
|
+
this.emit("selectionChanged" /* SELECTION_CHANGED */, this._selectedIndex, this.getSelectedOption());
|
|
4622
4705
|
}
|
|
4623
4706
|
selectCurrent() {
|
|
4624
4707
|
const selected = this.getSelectedOption();
|
|
4625
4708
|
if (selected) {
|
|
4626
|
-
this.emit("itemSelected" /* ITEM_SELECTED */, this.
|
|
4709
|
+
this.emit("itemSelected" /* ITEM_SELECTED */, this._selectedIndex, selected);
|
|
4627
4710
|
}
|
|
4628
4711
|
}
|
|
4629
4712
|
setSelectedIndex(index) {
|
|
4630
4713
|
if (index >= 0 && index < this._options.length) {
|
|
4631
|
-
this.
|
|
4714
|
+
this._selectedIndex = index;
|
|
4632
4715
|
this.updateScrollOffset();
|
|
4633
4716
|
this.requestRender();
|
|
4634
|
-
this.emit("selectionChanged" /* SELECTION_CHANGED */, this.
|
|
4717
|
+
this.emit("selectionChanged" /* SELECTION_CHANGED */, this._selectedIndex, this.getSelectedOption());
|
|
4635
4718
|
}
|
|
4636
4719
|
}
|
|
4637
4720
|
updateScrollOffset() {
|
|
4638
4721
|
if (!this._options)
|
|
4639
4722
|
return;
|
|
4640
4723
|
const halfVisible = Math.floor(this.maxVisibleItems / 2);
|
|
4641
|
-
const newScrollOffset = Math.max(0, Math.min(this.
|
|
4724
|
+
const newScrollOffset = Math.max(0, Math.min(this._selectedIndex - halfVisible, this._options.length - this.maxVisibleItems));
|
|
4642
4725
|
if (newScrollOffset !== this.scrollOffset) {
|
|
4643
4726
|
this.scrollOffset = newScrollOffset;
|
|
4644
4727
|
this.requestRender();
|
|
@@ -4770,6 +4853,15 @@ class SelectRenderable extends Renderable {
|
|
|
4770
4853
|
set fastScrollStep(step) {
|
|
4771
4854
|
this._fastScrollStep = step;
|
|
4772
4855
|
}
|
|
4856
|
+
set selectedIndex(value) {
|
|
4857
|
+
const newIndex = value ?? this._defaultOptions.selectedIndex;
|
|
4858
|
+
const clampedIndex = this._options.length > 0 ? Math.min(Math.max(0, newIndex), this._options.length - 1) : 0;
|
|
4859
|
+
if (this._selectedIndex !== clampedIndex) {
|
|
4860
|
+
this._selectedIndex = clampedIndex;
|
|
4861
|
+
this.updateScrollOffset();
|
|
4862
|
+
this.requestRender();
|
|
4863
|
+
}
|
|
4864
|
+
}
|
|
4773
4865
|
}
|
|
4774
4866
|
// src/renderables/TabSelect.ts
|
|
4775
4867
|
var TabSelectRenderableEvents;
|
|
@@ -5181,6 +5273,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
5181
5273
|
_scrollMargin = 0.2;
|
|
5182
5274
|
_showCursor = true;
|
|
5183
5275
|
_cursorColor;
|
|
5276
|
+
_cursorStyle;
|
|
5184
5277
|
lastLocalSelection = null;
|
|
5185
5278
|
_tabIndicator;
|
|
5186
5279
|
_tabIndicatorColor;
|
|
@@ -5199,6 +5292,10 @@ class EditBufferRenderable extends Renderable {
|
|
|
5199
5292
|
scrollMargin: 0.2,
|
|
5200
5293
|
showCursor: true,
|
|
5201
5294
|
cursorColor: RGBA.fromValues(1, 1, 1, 1),
|
|
5295
|
+
cursorStyle: {
|
|
5296
|
+
style: "block",
|
|
5297
|
+
blinking: true
|
|
5298
|
+
},
|
|
5202
5299
|
tabIndicator: undefined,
|
|
5203
5300
|
tabIndicatorColor: undefined
|
|
5204
5301
|
};
|
|
@@ -5214,6 +5311,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
5214
5311
|
this._scrollMargin = options.scrollMargin ?? this._defaultOptions.scrollMargin;
|
|
5215
5312
|
this._showCursor = options.showCursor ?? this._defaultOptions.showCursor;
|
|
5216
5313
|
this._cursorColor = parseColor(options.cursorColor ?? this._defaultOptions.cursorColor);
|
|
5314
|
+
this._cursorStyle = options.cursorStyle ?? this._defaultOptions.cursorStyle;
|
|
5217
5315
|
this._tabIndicator = options.tabIndicator ?? this._defaultOptions.tabIndicator;
|
|
5218
5316
|
this._tabIndicatorColor = options.tabIndicatorColor ? parseColor(options.tabIndicatorColor) : this._defaultOptions.tabIndicatorColor;
|
|
5219
5317
|
this.editBuffer = EditBuffer.create(this._ctx.widthMethod);
|
|
@@ -5356,7 +5454,21 @@ class EditBufferRenderable extends Renderable {
|
|
|
5356
5454
|
const newColor = parseColor(value);
|
|
5357
5455
|
if (this._cursorColor !== newColor) {
|
|
5358
5456
|
this._cursorColor = newColor;
|
|
5359
|
-
this.
|
|
5457
|
+
if (this._focused) {
|
|
5458
|
+
this.requestRender();
|
|
5459
|
+
}
|
|
5460
|
+
}
|
|
5461
|
+
}
|
|
5462
|
+
get cursorStyle() {
|
|
5463
|
+
return this._cursorStyle;
|
|
5464
|
+
}
|
|
5465
|
+
set cursorStyle(style) {
|
|
5466
|
+
const newStyle = style;
|
|
5467
|
+
if (this.cursorStyle.style !== newStyle.style || this.cursorStyle.blinking !== newStyle.blinking) {
|
|
5468
|
+
this._cursorStyle = newStyle;
|
|
5469
|
+
if (this._focused) {
|
|
5470
|
+
this.requestRender();
|
|
5471
|
+
}
|
|
5360
5472
|
}
|
|
5361
5473
|
}
|
|
5362
5474
|
get tabIndicator() {
|
|
@@ -5471,11 +5583,11 @@ class EditBufferRenderable extends Renderable {
|
|
|
5471
5583
|
const cursorY = this.y + visualCursor.visualRow + 1;
|
|
5472
5584
|
this._ctx.setCursorPosition(cursorX, cursorY, true);
|
|
5473
5585
|
this._ctx.setCursorColor(this._cursorColor);
|
|
5474
|
-
this._ctx.setCursorStyle(
|
|
5586
|
+
this._ctx.setCursorStyle(this._cursorStyle.style, this._cursorStyle.blinking);
|
|
5475
5587
|
}
|
|
5476
5588
|
focus() {
|
|
5477
5589
|
super.focus();
|
|
5478
|
-
this._ctx.setCursorStyle(
|
|
5590
|
+
this._ctx.setCursorStyle(this._cursorStyle.style, this._cursorStyle.blinking);
|
|
5479
5591
|
this._ctx.setCursorColor(this._cursorColor);
|
|
5480
5592
|
this.requestRender();
|
|
5481
5593
|
}
|
|
@@ -6222,5 +6334,5 @@ export {
|
|
|
6222
6334
|
ASCIIFont
|
|
6223
6335
|
};
|
|
6224
6336
|
|
|
6225
|
-
//# debugId=
|
|
6337
|
+
//# debugId=44707EEC392262B964756E2164756E21
|
|
6226
6338
|
//# sourceMappingURL=index.js.map
|