@opentui/core 0.1.31 → 0.1.33
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/assets/markdown/highlights.scm +150 -0
- package/assets/markdown/injections.scm +27 -0
- package/assets/markdown/tree-sitter-markdown.wasm +0 -0
- package/assets/markdown_inline/highlights.scm +115 -0
- package/assets/markdown_inline/tree-sitter-markdown_inline.wasm +0 -0
- package/edit-buffer.d.ts +2 -0
- package/editor-view.d.ts +2 -0
- package/{index-91qheh74.js → index-xqg0a6ka.js} +722 -147
- package/{index-91qheh74.js.map → index-xqg0a6ka.js.map} +16 -15
- package/index.js +204 -24
- package/index.js.map +14 -14
- package/lib/KeyHandler.d.ts +4 -1
- package/lib/index.d.ts +1 -0
- package/lib/parse.keypress.d.ts +1 -0
- package/lib/stdin-buffer.d.ts +42 -0
- package/lib/tree-sitter/client.d.ts +1 -0
- package/lib/tree-sitter/parsers-config.d.ts +38 -0
- package/lib/tree-sitter/types.d.ts +18 -1
- package/lib/tree-sitter-styled-text.d.ts +9 -2
- package/package.json +9 -9
- package/parser.worker.js +250 -27
- package/parser.worker.js.map +3 -3
- package/renderables/Box.d.ts +1 -0
- package/renderables/Code.d.ts +14 -0
- package/renderables/EditBufferRenderable.d.ts +12 -0
- package/renderables/TextBufferRenderable.d.ts +10 -0
- package/renderables/Textarea.d.ts +2 -1
- package/syntax-style.d.ts +2 -0
- package/testing/mock-keys.d.ts +2 -1
- package/testing.js +8 -6
- package/testing.js.map +3 -3
- package/text-buffer-view.d.ts +2 -0
- package/text-buffer.d.ts +4 -0
- package/zig.d.ts +11 -0
package/index.js
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
RendererControlState,
|
|
31
31
|
RootRenderable,
|
|
32
32
|
Selection,
|
|
33
|
+
StdinBuffer,
|
|
33
34
|
StyledText,
|
|
34
35
|
TerminalConsole,
|
|
35
36
|
TextAttributes,
|
|
@@ -133,7 +134,7 @@ import {
|
|
|
133
134
|
white,
|
|
134
135
|
wrapWithDelegates,
|
|
135
136
|
yellow
|
|
136
|
-
} from "./index-
|
|
137
|
+
} from "./index-xqg0a6ka.js";
|
|
137
138
|
// src/text-buffer-view.ts
|
|
138
139
|
class TextBufferView {
|
|
139
140
|
lib;
|
|
@@ -222,6 +223,15 @@ class TextBufferView {
|
|
|
222
223
|
return "";
|
|
223
224
|
return this.lib.decoder.decode(plainBytes);
|
|
224
225
|
}
|
|
226
|
+
setTabIndicator(indicator) {
|
|
227
|
+
this.guard();
|
|
228
|
+
const codePoint = typeof indicator === "string" ? indicator.codePointAt(0) ?? 0 : indicator;
|
|
229
|
+
this.lib.textBufferViewSetTabIndicator(this.viewPtr, codePoint);
|
|
230
|
+
}
|
|
231
|
+
setTabIndicatorColor(color) {
|
|
232
|
+
this.guard();
|
|
233
|
+
this.lib.textBufferViewSetTabIndicatorColor(this.viewPtr, color);
|
|
234
|
+
}
|
|
225
235
|
destroy() {
|
|
226
236
|
if (this._destroyed)
|
|
227
237
|
return;
|
|
@@ -421,6 +431,24 @@ class EditBuffer extends EventEmitter {
|
|
|
421
431
|
this.guard();
|
|
422
432
|
return this.lib.editBufferGetLineStartOffset(this.bufferPtr, row);
|
|
423
433
|
}
|
|
434
|
+
getTextRange(startOffset, endOffset) {
|
|
435
|
+
this.guard();
|
|
436
|
+
if (startOffset >= endOffset)
|
|
437
|
+
return "";
|
|
438
|
+
const maxSize = 1024 * 1024;
|
|
439
|
+
const textBytes = this.lib.editBufferGetTextRange(this.bufferPtr, startOffset, endOffset, maxSize);
|
|
440
|
+
if (!textBytes)
|
|
441
|
+
return "";
|
|
442
|
+
return this.lib.decoder.decode(textBytes);
|
|
443
|
+
}
|
|
444
|
+
getTextRangeByCoords(startRow, startCol, endRow, endCol) {
|
|
445
|
+
this.guard();
|
|
446
|
+
const maxSize = 1024 * 1024;
|
|
447
|
+
const textBytes = this.lib.editBufferGetTextRangeByCoords(this.bufferPtr, startRow, startCol, endRow, endCol, maxSize);
|
|
448
|
+
if (!textBytes)
|
|
449
|
+
return "";
|
|
450
|
+
return this.lib.decoder.decode(textBytes);
|
|
451
|
+
}
|
|
424
452
|
debugLogRope() {
|
|
425
453
|
this.guard();
|
|
426
454
|
this.lib.editBufferDebugLogRope(this.bufferPtr);
|
|
@@ -657,6 +685,15 @@ class EditorView {
|
|
|
657
685
|
this.guard();
|
|
658
686
|
this.lib.editorViewSetPlaceholderStyledText(this.viewPtr, chunks);
|
|
659
687
|
}
|
|
688
|
+
setTabIndicator(indicator) {
|
|
689
|
+
this.guard();
|
|
690
|
+
const codePoint = typeof indicator === "string" ? indicator.codePointAt(0) ?? 0 : indicator;
|
|
691
|
+
this.lib.editorViewSetTabIndicator(this.viewPtr, codePoint);
|
|
692
|
+
}
|
|
693
|
+
setTabIndicatorColor(color) {
|
|
694
|
+
this.guard();
|
|
695
|
+
this.lib.editorViewSetTabIndicatorColor(this.viewPtr, color);
|
|
696
|
+
}
|
|
660
697
|
destroy() {
|
|
661
698
|
if (this._destroyed)
|
|
662
699
|
return;
|
|
@@ -842,6 +879,14 @@ class SyntaxStyle {
|
|
|
842
879
|
this.guard();
|
|
843
880
|
return this.mergedCache.size;
|
|
844
881
|
}
|
|
882
|
+
getAllStyles() {
|
|
883
|
+
this.guard();
|
|
884
|
+
return new Map(this.styleDefs);
|
|
885
|
+
}
|
|
886
|
+
getRegisteredNames() {
|
|
887
|
+
this.guard();
|
|
888
|
+
return Array.from(this.styleDefs.keys());
|
|
889
|
+
}
|
|
845
890
|
destroy() {
|
|
846
891
|
if (this._destroyed)
|
|
847
892
|
return;
|
|
@@ -2176,6 +2221,13 @@ class BoxRenderable extends Renderable {
|
|
|
2176
2221
|
this.applyYogaGap(options);
|
|
2177
2222
|
}
|
|
2178
2223
|
}
|
|
2224
|
+
initializeBorder() {
|
|
2225
|
+
if (this._border === false) {
|
|
2226
|
+
this._border = true;
|
|
2227
|
+
this.borderSides = getBorderSides(this._border);
|
|
2228
|
+
this.applyYogaBorders();
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2179
2231
|
get customBorderChars() {
|
|
2180
2232
|
return this._customBorderCharsObj;
|
|
2181
2233
|
}
|
|
@@ -2210,9 +2262,10 @@ class BoxRenderable extends Renderable {
|
|
|
2210
2262
|
}
|
|
2211
2263
|
set borderStyle(value) {
|
|
2212
2264
|
let _value = value ?? this._defaultOptions.borderStyle;
|
|
2213
|
-
if (this._borderStyle !== _value) {
|
|
2265
|
+
if (this._borderStyle !== _value || !this._border) {
|
|
2214
2266
|
this._borderStyle = _value;
|
|
2215
2267
|
this._customBorderChars = undefined;
|
|
2268
|
+
this.initializeBorder();
|
|
2216
2269
|
this.requestRender();
|
|
2217
2270
|
}
|
|
2218
2271
|
}
|
|
@@ -2223,6 +2276,7 @@ class BoxRenderable extends Renderable {
|
|
|
2223
2276
|
const newColor = parseColor(value ?? this._defaultOptions.borderColor);
|
|
2224
2277
|
if (this._borderColor !== newColor) {
|
|
2225
2278
|
this._borderColor = newColor;
|
|
2279
|
+
this.initializeBorder();
|
|
2226
2280
|
this.requestRender();
|
|
2227
2281
|
}
|
|
2228
2282
|
}
|
|
@@ -2233,6 +2287,7 @@ class BoxRenderable extends Renderable {
|
|
|
2233
2287
|
const newColor = parseColor(value ?? this._defaultOptions.focusedBorderColor);
|
|
2234
2288
|
if (this._focusedBorderColor !== newColor) {
|
|
2235
2289
|
this._focusedBorderColor = newColor;
|
|
2290
|
+
this.initializeBorder();
|
|
2236
2291
|
if (this._focused) {
|
|
2237
2292
|
this.requestRender();
|
|
2238
2293
|
}
|
|
@@ -2338,6 +2393,8 @@ class TextBufferRenderable extends Renderable {
|
|
|
2338
2393
|
_selectionFg;
|
|
2339
2394
|
_wrapMode = "word";
|
|
2340
2395
|
lastLocalSelection = null;
|
|
2396
|
+
_tabIndicator;
|
|
2397
|
+
_tabIndicatorColor;
|
|
2341
2398
|
textBuffer;
|
|
2342
2399
|
textBufferView;
|
|
2343
2400
|
_lineInfo = { lineStarts: [], lineWidths: [], maxLineWidth: 0 };
|
|
@@ -2348,7 +2405,9 @@ class TextBufferRenderable extends Renderable {
|
|
|
2348
2405
|
selectionFg: undefined,
|
|
2349
2406
|
selectable: true,
|
|
2350
2407
|
attributes: 0,
|
|
2351
|
-
wrapMode: "word"
|
|
2408
|
+
wrapMode: "word",
|
|
2409
|
+
tabIndicator: undefined,
|
|
2410
|
+
tabIndicatorColor: undefined
|
|
2352
2411
|
};
|
|
2353
2412
|
constructor(ctx, options) {
|
|
2354
2413
|
super(ctx, options);
|
|
@@ -2359,6 +2418,8 @@ class TextBufferRenderable extends Renderable {
|
|
|
2359
2418
|
this._selectionFg = options.selectionFg ? parseColor(options.selectionFg) : this._defaultOptions.selectionFg;
|
|
2360
2419
|
this.selectable = options.selectable ?? this._defaultOptions.selectable;
|
|
2361
2420
|
this._wrapMode = options.wrapMode ?? this._defaultOptions.wrapMode;
|
|
2421
|
+
this._tabIndicator = options.tabIndicator ?? this._defaultOptions.tabIndicator;
|
|
2422
|
+
this._tabIndicatorColor = options.tabIndicatorColor ? parseColor(options.tabIndicatorColor) : this._defaultOptions.tabIndicatorColor;
|
|
2362
2423
|
this.textBuffer = TextBuffer.create(this._ctx.widthMethod);
|
|
2363
2424
|
this.textBufferView = TextBufferView.create(this.textBuffer);
|
|
2364
2425
|
const style = SyntaxStyle.create();
|
|
@@ -2368,6 +2429,12 @@ class TextBufferRenderable extends Renderable {
|
|
|
2368
2429
|
this.textBuffer.setDefaultFg(this._defaultFg);
|
|
2369
2430
|
this.textBuffer.setDefaultBg(this._defaultBg);
|
|
2370
2431
|
this.textBuffer.setDefaultAttributes(this._defaultAttributes);
|
|
2432
|
+
if (this._tabIndicator !== undefined) {
|
|
2433
|
+
this.textBufferView.setTabIndicator(this._tabIndicator);
|
|
2434
|
+
}
|
|
2435
|
+
if (this._tabIndicatorColor !== undefined) {
|
|
2436
|
+
this.textBufferView.setTabIndicatorColor(this._tabIndicatorColor);
|
|
2437
|
+
}
|
|
2371
2438
|
if (this._wrapMode !== "none" && this.width > 0) {
|
|
2372
2439
|
this.updateWrapWidth(this.width);
|
|
2373
2440
|
}
|
|
@@ -2454,6 +2521,31 @@ class TextBufferRenderable extends Renderable {
|
|
|
2454
2521
|
this.requestRender();
|
|
2455
2522
|
}
|
|
2456
2523
|
}
|
|
2524
|
+
get tabIndicator() {
|
|
2525
|
+
return this._tabIndicator;
|
|
2526
|
+
}
|
|
2527
|
+
set tabIndicator(value) {
|
|
2528
|
+
if (this._tabIndicator !== value) {
|
|
2529
|
+
this._tabIndicator = value;
|
|
2530
|
+
if (value !== undefined) {
|
|
2531
|
+
this.textBufferView.setTabIndicator(value);
|
|
2532
|
+
}
|
|
2533
|
+
this.requestRender();
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
get tabIndicatorColor() {
|
|
2537
|
+
return this._tabIndicatorColor;
|
|
2538
|
+
}
|
|
2539
|
+
set tabIndicatorColor(value) {
|
|
2540
|
+
const newColor = value ? parseColor(value) : undefined;
|
|
2541
|
+
if (this._tabIndicatorColor !== newColor) {
|
|
2542
|
+
this._tabIndicatorColor = newColor;
|
|
2543
|
+
if (newColor !== undefined) {
|
|
2544
|
+
this.textBufferView.setTabIndicatorColor(newColor);
|
|
2545
|
+
}
|
|
2546
|
+
this.requestRender();
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2457
2549
|
onResize(width, height) {
|
|
2458
2550
|
this.textBufferView.setViewportSize(width, height);
|
|
2459
2551
|
if (this.lastLocalSelection) {
|
|
@@ -2568,8 +2660,14 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
2568
2660
|
_isHighlighting = false;
|
|
2569
2661
|
_treeSitterClient;
|
|
2570
2662
|
_pendingRehighlight = false;
|
|
2663
|
+
_pendingUpdate = false;
|
|
2664
|
+
_currentHighlightId = 0;
|
|
2665
|
+
_conceal;
|
|
2666
|
+
_drawUnstyledText;
|
|
2571
2667
|
_contentDefaultOptions = {
|
|
2572
|
-
content: ""
|
|
2668
|
+
content: "",
|
|
2669
|
+
conceal: true,
|
|
2670
|
+
drawUnstyledText: true
|
|
2573
2671
|
};
|
|
2574
2672
|
constructor(ctx, options) {
|
|
2575
2673
|
super(ctx, options);
|
|
@@ -2577,6 +2675,8 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
2577
2675
|
this._filetype = options.filetype;
|
|
2578
2676
|
this._syntaxStyle = options.syntaxStyle;
|
|
2579
2677
|
this._treeSitterClient = options.treeSitterClient ?? getTreeSitterClient();
|
|
2678
|
+
this._conceal = options.conceal ?? this._contentDefaultOptions.conceal;
|
|
2679
|
+
this._drawUnstyledText = options.drawUnstyledText ?? this._contentDefaultOptions.drawUnstyledText;
|
|
2580
2680
|
this.updateContent(this._content);
|
|
2581
2681
|
}
|
|
2582
2682
|
get content() {
|
|
@@ -2585,7 +2685,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
2585
2685
|
set content(value) {
|
|
2586
2686
|
if (this._content !== value) {
|
|
2587
2687
|
this._content = value;
|
|
2588
|
-
this.
|
|
2688
|
+
this.scheduleUpdate();
|
|
2589
2689
|
}
|
|
2590
2690
|
}
|
|
2591
2691
|
get filetype() {
|
|
@@ -2594,7 +2694,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
2594
2694
|
set filetype(value) {
|
|
2595
2695
|
if (this._filetype !== value) {
|
|
2596
2696
|
this._filetype = value;
|
|
2597
|
-
this.
|
|
2697
|
+
this.scheduleUpdate();
|
|
2598
2698
|
}
|
|
2599
2699
|
}
|
|
2600
2700
|
get syntaxStyle() {
|
|
@@ -2603,36 +2703,70 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
2603
2703
|
set syntaxStyle(value) {
|
|
2604
2704
|
if (this._syntaxStyle !== value) {
|
|
2605
2705
|
this._syntaxStyle = value;
|
|
2606
|
-
this.
|
|
2706
|
+
this.scheduleUpdate();
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
get conceal() {
|
|
2710
|
+
return this._conceal;
|
|
2711
|
+
}
|
|
2712
|
+
set conceal(value) {
|
|
2713
|
+
if (this._conceal !== value) {
|
|
2714
|
+
this._conceal = value;
|
|
2715
|
+
this.scheduleUpdate();
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
get drawUnstyledText() {
|
|
2719
|
+
return this._drawUnstyledText;
|
|
2720
|
+
}
|
|
2721
|
+
set drawUnstyledText(value) {
|
|
2722
|
+
if (this._drawUnstyledText !== value) {
|
|
2723
|
+
this._drawUnstyledText = value;
|
|
2724
|
+
this.scheduleUpdate();
|
|
2607
2725
|
}
|
|
2608
2726
|
}
|
|
2727
|
+
scheduleUpdate() {
|
|
2728
|
+
if (this._pendingUpdate)
|
|
2729
|
+
return;
|
|
2730
|
+
this._pendingUpdate = true;
|
|
2731
|
+
queueMicrotask(() => {
|
|
2732
|
+
this._pendingUpdate = false;
|
|
2733
|
+
this.updateContent(this._content);
|
|
2734
|
+
});
|
|
2735
|
+
}
|
|
2609
2736
|
async updateContent(content) {
|
|
2610
2737
|
if (content.length === 0)
|
|
2611
2738
|
return;
|
|
2612
|
-
if (this._isHighlighting) {
|
|
2613
|
-
this._pendingRehighlight = true;
|
|
2614
|
-
return;
|
|
2615
|
-
}
|
|
2616
2739
|
if (!this._filetype) {
|
|
2617
2740
|
this.fallback(content);
|
|
2618
2741
|
return;
|
|
2619
2742
|
}
|
|
2620
|
-
this.
|
|
2743
|
+
this._currentHighlightId++;
|
|
2744
|
+
const highlightId = this._currentHighlightId;
|
|
2745
|
+
if (this._drawUnstyledText) {
|
|
2746
|
+
this.fallback(content);
|
|
2747
|
+
}
|
|
2621
2748
|
this._isHighlighting = true;
|
|
2749
|
+
this._pendingRehighlight = false;
|
|
2622
2750
|
try {
|
|
2623
|
-
const styledText = await treeSitterToStyledText(content, this._filetype, this._syntaxStyle, this._treeSitterClient
|
|
2751
|
+
const styledText = await treeSitterToStyledText(content, this._filetype, this._syntaxStyle, this._treeSitterClient, {
|
|
2752
|
+
conceal: { enabled: this._conceal }
|
|
2753
|
+
});
|
|
2754
|
+
if (highlightId !== this._currentHighlightId) {
|
|
2755
|
+
return;
|
|
2756
|
+
}
|
|
2624
2757
|
if (this.isDestroyed)
|
|
2625
2758
|
return;
|
|
2626
2759
|
this.textBuffer.setStyledText(styledText);
|
|
2627
2760
|
this.updateTextInfo();
|
|
2628
2761
|
} catch (error) {
|
|
2762
|
+
if (highlightId !== this._currentHighlightId) {
|
|
2763
|
+
return;
|
|
2764
|
+
}
|
|
2629
2765
|
console.warn("Code highlighting failed, falling back to plain text:", error);
|
|
2630
2766
|
this.fallback(content);
|
|
2631
2767
|
} finally {
|
|
2632
|
-
this.
|
|
2633
|
-
|
|
2634
|
-
this._pendingRehighlight = false;
|
|
2635
|
-
process.nextTick(() => this.updateContent(this._content));
|
|
2768
|
+
if (highlightId === this._currentHighlightId) {
|
|
2769
|
+
this._isHighlighting = false;
|
|
2636
2770
|
}
|
|
2637
2771
|
}
|
|
2638
2772
|
}
|
|
@@ -2655,6 +2789,9 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
2655
2789
|
];
|
|
2656
2790
|
return new StyledText(chunks);
|
|
2657
2791
|
}
|
|
2792
|
+
getLineHighlights(lineIdx) {
|
|
2793
|
+
return this.textBuffer.getLineHighlights(lineIdx);
|
|
2794
|
+
}
|
|
2658
2795
|
}
|
|
2659
2796
|
// src/renderables/TextNode.ts
|
|
2660
2797
|
var BrandedTextNodeRenderable = Symbol.for("@opentui/core/TextNodeRenderable");
|
|
@@ -3151,7 +3288,7 @@ class InputRenderable extends Renderable {
|
|
|
3151
3288
|
this.deleteCharacter("forward");
|
|
3152
3289
|
return true;
|
|
3153
3290
|
case "return":
|
|
3154
|
-
case "
|
|
3291
|
+
case "linefeed":
|
|
3155
3292
|
if (this._value !== this._lastCommittedValue) {
|
|
3156
3293
|
this._lastCommittedValue = this._value;
|
|
3157
3294
|
this.emit("change" /* CHANGE */, this._value);
|
|
@@ -4506,7 +4643,7 @@ class SelectRenderable extends Renderable {
|
|
|
4506
4643
|
this.moveDown(isShift ? this._fastScrollStep : 1);
|
|
4507
4644
|
return true;
|
|
4508
4645
|
case "return":
|
|
4509
|
-
case "
|
|
4646
|
+
case "linefeed":
|
|
4510
4647
|
this.selectCurrent();
|
|
4511
4648
|
return true;
|
|
4512
4649
|
}
|
|
@@ -4825,7 +4962,7 @@ class TabSelectRenderable extends Renderable {
|
|
|
4825
4962
|
this.moveRight();
|
|
4826
4963
|
return true;
|
|
4827
4964
|
case "return":
|
|
4828
|
-
case "
|
|
4965
|
+
case "linefeed":
|
|
4829
4966
|
this.selectCurrent();
|
|
4830
4967
|
return true;
|
|
4831
4968
|
}
|
|
@@ -5026,6 +5163,8 @@ class EditBufferRenderable extends Renderable {
|
|
|
5026
5163
|
_showCursor = true;
|
|
5027
5164
|
_cursorColor;
|
|
5028
5165
|
lastLocalSelection = null;
|
|
5166
|
+
_tabIndicator;
|
|
5167
|
+
_tabIndicatorColor;
|
|
5029
5168
|
_cursorChangeListener = undefined;
|
|
5030
5169
|
_contentChangeListener = undefined;
|
|
5031
5170
|
editBuffer;
|
|
@@ -5040,7 +5179,9 @@ class EditBufferRenderable extends Renderable {
|
|
|
5040
5179
|
wrapMode: "word",
|
|
5041
5180
|
scrollMargin: 0.2,
|
|
5042
5181
|
showCursor: true,
|
|
5043
|
-
cursorColor: RGBA.fromValues(1, 1, 1, 1)
|
|
5182
|
+
cursorColor: RGBA.fromValues(1, 1, 1, 1),
|
|
5183
|
+
tabIndicator: undefined,
|
|
5184
|
+
tabIndicatorColor: undefined
|
|
5044
5185
|
};
|
|
5045
5186
|
constructor(ctx, options) {
|
|
5046
5187
|
super(ctx, options);
|
|
@@ -5054,6 +5195,8 @@ class EditBufferRenderable extends Renderable {
|
|
|
5054
5195
|
this._scrollMargin = options.scrollMargin ?? this._defaultOptions.scrollMargin;
|
|
5055
5196
|
this._showCursor = options.showCursor ?? this._defaultOptions.showCursor;
|
|
5056
5197
|
this._cursorColor = parseColor(options.cursorColor ?? this._defaultOptions.cursorColor);
|
|
5198
|
+
this._tabIndicator = options.tabIndicator ?? this._defaultOptions.tabIndicator;
|
|
5199
|
+
this._tabIndicatorColor = options.tabIndicatorColor ? parseColor(options.tabIndicatorColor) : this._defaultOptions.tabIndicatorColor;
|
|
5057
5200
|
this.editBuffer = EditBuffer.create(this._ctx.widthMethod);
|
|
5058
5201
|
this.editorView = EditorView.create(this.editBuffer, this.width || 80, this.height || 24);
|
|
5059
5202
|
this.editorView.setWrapMode(this._wrapMode);
|
|
@@ -5064,6 +5207,12 @@ class EditBufferRenderable extends Renderable {
|
|
|
5064
5207
|
if (options.syntaxStyle) {
|
|
5065
5208
|
this.editBuffer.setSyntaxStyle(options.syntaxStyle);
|
|
5066
5209
|
}
|
|
5210
|
+
if (this._tabIndicator !== undefined) {
|
|
5211
|
+
this.editorView.setTabIndicator(this._tabIndicator);
|
|
5212
|
+
}
|
|
5213
|
+
if (this._tabIndicatorColor !== undefined) {
|
|
5214
|
+
this.editorView.setTabIndicatorColor(this._tabIndicatorColor);
|
|
5215
|
+
}
|
|
5067
5216
|
this.setupMeasureFunc();
|
|
5068
5217
|
this.setupEventListeners(options);
|
|
5069
5218
|
}
|
|
@@ -5191,6 +5340,31 @@ class EditBufferRenderable extends Renderable {
|
|
|
5191
5340
|
this.requestRender();
|
|
5192
5341
|
}
|
|
5193
5342
|
}
|
|
5343
|
+
get tabIndicator() {
|
|
5344
|
+
return this._tabIndicator;
|
|
5345
|
+
}
|
|
5346
|
+
set tabIndicator(value) {
|
|
5347
|
+
if (this._tabIndicator !== value) {
|
|
5348
|
+
this._tabIndicator = value;
|
|
5349
|
+
if (value !== undefined) {
|
|
5350
|
+
this.editorView.setTabIndicator(value);
|
|
5351
|
+
}
|
|
5352
|
+
this.requestRender();
|
|
5353
|
+
}
|
|
5354
|
+
}
|
|
5355
|
+
get tabIndicatorColor() {
|
|
5356
|
+
return this._tabIndicatorColor;
|
|
5357
|
+
}
|
|
5358
|
+
set tabIndicatorColor(value) {
|
|
5359
|
+
const newColor = value ? parseColor(value) : undefined;
|
|
5360
|
+
if (this._tabIndicatorColor !== newColor) {
|
|
5361
|
+
this._tabIndicatorColor = newColor;
|
|
5362
|
+
if (newColor !== undefined) {
|
|
5363
|
+
this.editorView.setTabIndicatorColor(newColor);
|
|
5364
|
+
}
|
|
5365
|
+
this.requestRender();
|
|
5366
|
+
}
|
|
5367
|
+
}
|
|
5194
5368
|
onResize(width, height) {
|
|
5195
5369
|
this.editorView.setViewportSize(width, height);
|
|
5196
5370
|
if (this.lastLocalSelection) {
|
|
@@ -5367,6 +5541,12 @@ class EditBufferRenderable extends Renderable {
|
|
|
5367
5541
|
this.yogaNode.markDirty();
|
|
5368
5542
|
this.requestRender();
|
|
5369
5543
|
}
|
|
5544
|
+
getTextRange(startOffset, endOffset) {
|
|
5545
|
+
return this.editBuffer.getTextRange(startOffset, endOffset);
|
|
5546
|
+
}
|
|
5547
|
+
getTextRangeByCoords(startRow, startCol, endRow, endCol) {
|
|
5548
|
+
return this.editBuffer.getTextRangeByCoords(startRow, startCol, endRow, endCol);
|
|
5549
|
+
}
|
|
5370
5550
|
}
|
|
5371
5551
|
|
|
5372
5552
|
// src/lib/keymapping.ts
|
|
@@ -5415,9 +5595,8 @@ var defaultTextareaKeybindings = [
|
|
|
5415
5595
|
{ name: "backspace", action: "backspace" },
|
|
5416
5596
|
{ name: "delete", action: "delete" },
|
|
5417
5597
|
{ name: "return", action: "newline" },
|
|
5418
|
-
{ name: "
|
|
5598
|
+
{ name: "linefeed", action: "newline" },
|
|
5419
5599
|
{ name: "return", meta: true, action: "submit" },
|
|
5420
|
-
{ name: "enter", meta: true, action: "submit" },
|
|
5421
5600
|
{ name: "z", ctrl: true, action: "undo" },
|
|
5422
5601
|
{ name: "Z", ctrl: true, shift: true, action: "redo" },
|
|
5423
5602
|
{ name: "y", ctrl: true, action: "redo" },
|
|
@@ -5968,6 +6147,7 @@ export {
|
|
|
5968
6147
|
TabSelect,
|
|
5969
6148
|
SyntaxStyle,
|
|
5970
6149
|
StyledText,
|
|
6150
|
+
StdinBuffer,
|
|
5971
6151
|
SliderRenderable,
|
|
5972
6152
|
Selection,
|
|
5973
6153
|
SelectRenderableEvents,
|
|
@@ -6023,5 +6203,5 @@ export {
|
|
|
6023
6203
|
ASCIIFont
|
|
6024
6204
|
};
|
|
6025
6205
|
|
|
6026
|
-
//# debugId=
|
|
6206
|
+
//# debugId=1FBC3EC4899A6D8064756E2164756E21
|
|
6027
6207
|
//# sourceMappingURL=index.js.map
|