@opentui/core 0.1.74 → 0.1.76
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/ThreeRenderable.d.ts +40 -0
- package/3d/index.d.ts +1 -0
- package/3d.js +165 -2
- package/3d.js.map +4 -3
- package/Renderable.d.ts +1 -0
- package/buffer.d.ts +4 -1
- package/console.d.ts +1 -1
- package/editor-view.d.ts +2 -2
- package/{index-93qf6w1k.js → index-phtsmwj4.js} +322 -116
- package/index-phtsmwj4.js.map +61 -0
- package/index.js +4669 -2811
- package/index.js.map +15 -12
- package/lib/RGBA.d.ts +1 -0
- package/lib/border.d.ts +2 -0
- package/lib/clipboard.d.ts +17 -0
- package/lib/selection.d.ts +3 -3
- package/package.json +8 -7
- package/parser.worker.js +1 -17
- package/parser.worker.js.map +2 -2
- package/renderables/Box.d.ts +1 -0
- package/renderables/Code.d.ts +11 -0
- package/renderables/EditBufferRenderable.d.ts +1 -0
- package/renderables/Input.d.ts +45 -73
- package/renderables/Markdown.d.ts +92 -0
- package/renderables/Textarea.d.ts +6 -1
- package/renderables/composition/constructs.d.ts +3 -1
- package/renderables/index.d.ts +1 -0
- package/renderables/markdown-parser.d.ts +10 -0
- package/renderer.d.ts +13 -4
- package/testing/test-renderer.d.ts +2 -0
- package/testing.js +17 -3
- package/testing.js.map +3 -3
- package/types.d.ts +19 -1
- package/zig-structs.d.ts +1 -1
- package/zig.d.ts +8 -3
- package/index-93qf6w1k.js.map +0 -60
|
@@ -1666,6 +1666,19 @@ var Yoga = wrapAssembly(await yoga_wasm_base64_esm_default());
|
|
|
1666
1666
|
var src_default = Yoga;
|
|
1667
1667
|
|
|
1668
1668
|
// src/lib/border.ts
|
|
1669
|
+
var VALID_BORDER_STYLES = ["single", "double", "rounded", "heavy"];
|
|
1670
|
+
function isValidBorderStyle(value) {
|
|
1671
|
+
return typeof value === "string" && VALID_BORDER_STYLES.includes(value);
|
|
1672
|
+
}
|
|
1673
|
+
function parseBorderStyle(value, fallback = "single") {
|
|
1674
|
+
if (isValidBorderStyle(value)) {
|
|
1675
|
+
return value;
|
|
1676
|
+
}
|
|
1677
|
+
if (value !== undefined && value !== null) {
|
|
1678
|
+
console.warn(`Invalid borderStyle "${value}", falling back to "${fallback}". Valid values are: ${VALID_BORDER_STYLES.join(", ")}`);
|
|
1679
|
+
}
|
|
1680
|
+
return fallback;
|
|
1681
|
+
}
|
|
1669
1682
|
var BorderChars = {
|
|
1670
1683
|
single: {
|
|
1671
1684
|
topLeft: "\u250C",
|
|
@@ -2260,7 +2273,12 @@ var parseKeypress = (s = "", options = {}) => {
|
|
|
2260
2273
|
} else if (charCode === 127 || charCode === 8) {
|
|
2261
2274
|
key.name = "backspace";
|
|
2262
2275
|
} else {
|
|
2263
|
-
|
|
2276
|
+
const char = String.fromCharCode(charCode);
|
|
2277
|
+
key.name = char;
|
|
2278
|
+
key.sequence = char;
|
|
2279
|
+
if (charCode >= 48 && charCode <= 57) {
|
|
2280
|
+
key.number = true;
|
|
2281
|
+
}
|
|
2264
2282
|
}
|
|
2265
2283
|
return key;
|
|
2266
2284
|
}
|
|
@@ -2584,6 +2602,11 @@ class RGBA {
|
|
|
2584
2602
|
toString() {
|
|
2585
2603
|
return `rgba(${this.r.toFixed(2)}, ${this.g.toFixed(2)}, ${this.b.toFixed(2)}, ${this.a.toFixed(2)})`;
|
|
2586
2604
|
}
|
|
2605
|
+
equals(other) {
|
|
2606
|
+
if (!other)
|
|
2607
|
+
return false;
|
|
2608
|
+
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
|
|
2609
|
+
}
|
|
2587
2610
|
}
|
|
2588
2611
|
function hexToRgb(hex) {
|
|
2589
2612
|
hex = hex.replace(/^#/, "");
|
|
@@ -6574,7 +6597,7 @@ class Selection {
|
|
|
6574
6597
|
_selectedRenderables = [];
|
|
6575
6598
|
_touchedRenderables = [];
|
|
6576
6599
|
_isActive = true;
|
|
6577
|
-
|
|
6600
|
+
_isDragging = true;
|
|
6578
6601
|
_isStart = false;
|
|
6579
6602
|
constructor(anchorRenderable, anchor, focus) {
|
|
6580
6603
|
this._anchor = new SelectionAnchor(anchorRenderable, anchor.x, anchor.y);
|
|
@@ -6601,11 +6624,11 @@ class Selection {
|
|
|
6601
6624
|
set isActive(value) {
|
|
6602
6625
|
this._isActive = value;
|
|
6603
6626
|
}
|
|
6604
|
-
get
|
|
6605
|
-
return this.
|
|
6627
|
+
get isDragging() {
|
|
6628
|
+
return this._isDragging;
|
|
6606
6629
|
}
|
|
6607
|
-
set
|
|
6608
|
-
this.
|
|
6630
|
+
set isDragging(value) {
|
|
6631
|
+
this._isDragging = value;
|
|
6609
6632
|
}
|
|
6610
6633
|
get bounds() {
|
|
6611
6634
|
const minX = Math.min(this._anchor.x, this._focus.x);
|
|
@@ -8474,6 +8497,7 @@ class ExtmarksController {
|
|
|
8474
8497
|
this.originalMoveDownVisual();
|
|
8475
8498
|
return;
|
|
8476
8499
|
}
|
|
8500
|
+
const currentOffset = this.editorView.getVisualCursor().offset;
|
|
8477
8501
|
this.originalMoveDownVisual();
|
|
8478
8502
|
const newOffset = this.editorView.getVisualCursor().offset;
|
|
8479
8503
|
const virtualExtmark = this.findVirtualExtmarkContaining(newOffset);
|
|
@@ -8481,7 +8505,9 @@ class ExtmarksController {
|
|
|
8481
8505
|
const distanceToStart = newOffset - virtualExtmark.start;
|
|
8482
8506
|
const distanceToEnd = virtualExtmark.end - newOffset;
|
|
8483
8507
|
if (distanceToStart < distanceToEnd) {
|
|
8484
|
-
|
|
8508
|
+
const adjustedOffset = virtualExtmark.start - 1;
|
|
8509
|
+
const targetOffset = adjustedOffset <= currentOffset ? virtualExtmark.end : adjustedOffset;
|
|
8510
|
+
this.editorView.setCursorByOffset(targetOffset);
|
|
8485
8511
|
} else {
|
|
8486
8512
|
this.editorView.setCursorByOffset(virtualExtmark.end);
|
|
8487
8513
|
}
|
|
@@ -9273,12 +9299,12 @@ function createTerminalPalette(stdin, stdout, writeFn, isLegacyTmux) {
|
|
|
9273
9299
|
return new TerminalPalette(stdin, stdout, writeFn, isLegacyTmux);
|
|
9274
9300
|
}
|
|
9275
9301
|
// src/zig.ts
|
|
9276
|
-
import { dlopen, toArrayBuffer as toArrayBuffer4, JSCallback, ptr as
|
|
9302
|
+
import { dlopen, toArrayBuffer as toArrayBuffer4, JSCallback, ptr as ptr4 } from "bun:ffi";
|
|
9277
9303
|
import { existsSync as existsSync2 } from "fs";
|
|
9278
9304
|
import { EventEmitter as EventEmitter5 } from "events";
|
|
9279
9305
|
|
|
9280
9306
|
// src/buffer.ts
|
|
9281
|
-
import { toArrayBuffer } from "bun:ffi";
|
|
9307
|
+
import { toArrayBuffer, ptr } from "bun:ffi";
|
|
9282
9308
|
function packDrawOptions(border2, shouldFill, titleAlignment) {
|
|
9283
9309
|
let packed = 0;
|
|
9284
9310
|
if (border2 === true) {
|
|
@@ -9341,14 +9367,14 @@ class OptimizedBuffer {
|
|
|
9341
9367
|
}
|
|
9342
9368
|
return this._rawBuffers;
|
|
9343
9369
|
}
|
|
9344
|
-
constructor(lib,
|
|
9370
|
+
constructor(lib, ptr2, width, height, options) {
|
|
9345
9371
|
this.id = options.id || `fb_${OptimizedBuffer.fbIdCounter++}`;
|
|
9346
9372
|
this.lib = lib;
|
|
9347
9373
|
this.respectAlpha = options.respectAlpha || false;
|
|
9348
9374
|
this._width = width;
|
|
9349
9375
|
this._height = height;
|
|
9350
9376
|
this._widthMethod = options.widthMethod || "unicode";
|
|
9351
|
-
this.bufferPtr =
|
|
9377
|
+
this.bufferPtr = ptr2;
|
|
9352
9378
|
}
|
|
9353
9379
|
static create(width, height, widthMethod, options = {}) {
|
|
9354
9380
|
const lib = resolveRenderLib();
|
|
@@ -9382,6 +9408,51 @@ class OptimizedBuffer {
|
|
|
9382
9408
|
const bytesWritten = this.lib.bufferWriteResolvedChars(this.bufferPtr, outputBuffer, addLineBreaks);
|
|
9383
9409
|
return outputBuffer.slice(0, bytesWritten);
|
|
9384
9410
|
}
|
|
9411
|
+
getSpanLines() {
|
|
9412
|
+
this.guard();
|
|
9413
|
+
const { char, fg: fg2, bg: bg2, attributes } = this.buffers;
|
|
9414
|
+
const lines = [];
|
|
9415
|
+
const CHAR_FLAG_CONTINUATION = 3221225472 | 0;
|
|
9416
|
+
const CHAR_FLAG_MASK = 3221225472 | 0;
|
|
9417
|
+
const realTextBytes = this.getRealCharBytes(true);
|
|
9418
|
+
const realTextLines = new TextDecoder().decode(realTextBytes).split(`
|
|
9419
|
+
`);
|
|
9420
|
+
for (let y = 0;y < this._height; y++) {
|
|
9421
|
+
const spans = [];
|
|
9422
|
+
let currentSpan = null;
|
|
9423
|
+
const lineChars = [...realTextLines[y] || ""];
|
|
9424
|
+
let charIdx = 0;
|
|
9425
|
+
for (let x = 0;x < this._width; x++) {
|
|
9426
|
+
const i = y * this._width + x;
|
|
9427
|
+
const cp = char[i];
|
|
9428
|
+
const cellFg = RGBA.fromValues(fg2[i * 4], fg2[i * 4 + 1], fg2[i * 4 + 2], fg2[i * 4 + 3]);
|
|
9429
|
+
const cellBg = RGBA.fromValues(bg2[i * 4], bg2[i * 4 + 1], bg2[i * 4 + 2], bg2[i * 4 + 3]);
|
|
9430
|
+
const cellAttrs = attributes[i] & 255;
|
|
9431
|
+
const isContinuation = (cp & CHAR_FLAG_MASK) === CHAR_FLAG_CONTINUATION;
|
|
9432
|
+
const cellChar = isContinuation ? "" : lineChars[charIdx++] ?? " ";
|
|
9433
|
+
if (currentSpan && currentSpan.fg.equals(cellFg) && currentSpan.bg.equals(cellBg) && currentSpan.attributes === cellAttrs) {
|
|
9434
|
+
currentSpan.text += cellChar;
|
|
9435
|
+
currentSpan.width += 1;
|
|
9436
|
+
} else {
|
|
9437
|
+
if (currentSpan) {
|
|
9438
|
+
spans.push(currentSpan);
|
|
9439
|
+
}
|
|
9440
|
+
currentSpan = {
|
|
9441
|
+
text: cellChar,
|
|
9442
|
+
fg: cellFg,
|
|
9443
|
+
bg: cellBg,
|
|
9444
|
+
attributes: cellAttrs,
|
|
9445
|
+
width: 1
|
|
9446
|
+
};
|
|
9447
|
+
}
|
|
9448
|
+
}
|
|
9449
|
+
if (currentSpan) {
|
|
9450
|
+
spans.push(currentSpan);
|
|
9451
|
+
}
|
|
9452
|
+
lines.push({ spans });
|
|
9453
|
+
}
|
|
9454
|
+
return lines;
|
|
9455
|
+
}
|
|
9385
9456
|
clear(bg2 = RGBA.fromValues(0, 0, 0, 1)) {
|
|
9386
9457
|
this.guard();
|
|
9387
9458
|
this.lib.bufferClear(this.bufferPtr, bg2);
|
|
@@ -9453,6 +9524,14 @@ class OptimizedBuffer {
|
|
|
9453
9524
|
this.guard();
|
|
9454
9525
|
this.lib.bufferDrawPackedBuffer(this.bufferPtr, dataPtr, dataLen, posX, posY, terminalWidthCells, terminalHeightCells);
|
|
9455
9526
|
}
|
|
9527
|
+
drawGrayscaleBuffer(posX, posY, intensities, srcWidth, srcHeight, fg2 = null, bg2 = null) {
|
|
9528
|
+
this.guard();
|
|
9529
|
+
this.lib.bufferDrawGrayscaleBuffer(this.bufferPtr, posX, posY, ptr(intensities), srcWidth, srcHeight, fg2, bg2);
|
|
9530
|
+
}
|
|
9531
|
+
drawGrayscaleBufferSupersampled(posX, posY, intensities, srcWidth, srcHeight, fg2 = null, bg2 = null) {
|
|
9532
|
+
this.guard();
|
|
9533
|
+
this.lib.bufferDrawGrayscaleBufferSupersampled(this.bufferPtr, posX, posY, ptr(intensities), srcWidth, srcHeight, fg2, bg2);
|
|
9534
|
+
}
|
|
9456
9535
|
resize(width, height) {
|
|
9457
9536
|
this.guard();
|
|
9458
9537
|
if (this._width === width && this._height === height)
|
|
@@ -9464,7 +9543,7 @@ class OptimizedBuffer {
|
|
|
9464
9543
|
}
|
|
9465
9544
|
drawBox(options) {
|
|
9466
9545
|
this.guard();
|
|
9467
|
-
const style = options.borderStyle
|
|
9546
|
+
const style = parseBorderStyle(options.borderStyle, "single");
|
|
9468
9547
|
const borderChars = options.customBorderChars ?? BorderCharArrays[style];
|
|
9469
9548
|
const packedOptions = packDrawOptions(options.border, options.shouldFill ?? false, options.titleAlignment || "left");
|
|
9470
9549
|
this.lib.bufferDrawBox(this.bufferPtr, options.x, options.y, options.width, options.height, borderChars, packedOptions, options.borderColor, options.backgroundColor, options.title ?? null);
|
|
@@ -9512,7 +9591,7 @@ class OptimizedBuffer {
|
|
|
9512
9591
|
}
|
|
9513
9592
|
|
|
9514
9593
|
// ../../node_modules/.bun/bun-ffi-structs@0.1.2+1fb4c65d43e298b9/node_modules/bun-ffi-structs/index.js
|
|
9515
|
-
import { ptr, toArrayBuffer as toArrayBuffer2 } from "bun:ffi";
|
|
9594
|
+
import { ptr as ptr2, toArrayBuffer as toArrayBuffer2 } from "bun:ffi";
|
|
9516
9595
|
function fatalError(...args) {
|
|
9517
9596
|
const message = args.join(" ");
|
|
9518
9597
|
console.error("FATAL ERROR:", message);
|
|
@@ -9674,7 +9753,7 @@ function defineStruct(fields, structDefOptions) {
|
|
|
9674
9753
|
size = pointerSize;
|
|
9675
9754
|
align = pointerSize;
|
|
9676
9755
|
pack = (view, off, val) => {
|
|
9677
|
-
const bufPtr = val ?
|
|
9756
|
+
const bufPtr = val ? ptr2(encoder.encode(val + "\x00")) : null;
|
|
9678
9757
|
pointerPacker(view, off, bufPtr);
|
|
9679
9758
|
};
|
|
9680
9759
|
unpack = (view, off) => {
|
|
@@ -9685,7 +9764,7 @@ function defineStruct(fields, structDefOptions) {
|
|
|
9685
9764
|
size = pointerSize;
|
|
9686
9765
|
align = pointerSize;
|
|
9687
9766
|
pack = (view, off, val) => {
|
|
9688
|
-
const bufPtr = val ?
|
|
9767
|
+
const bufPtr = val ? ptr2(encoder.encode(val)) : null;
|
|
9689
9768
|
pointerPacker(view, off, bufPtr);
|
|
9690
9769
|
};
|
|
9691
9770
|
unpack = (view, off) => {
|
|
@@ -9716,7 +9795,7 @@ function defineStruct(fields, structDefOptions) {
|
|
|
9716
9795
|
return;
|
|
9717
9796
|
}
|
|
9718
9797
|
const nestedBuf = typeOrStruct.pack(val, options2);
|
|
9719
|
-
pointerPacker(view, off,
|
|
9798
|
+
pointerPacker(view, off, ptr2(nestedBuf));
|
|
9720
9799
|
};
|
|
9721
9800
|
unpack = (view, off) => {
|
|
9722
9801
|
throw new Error("Not implemented yet");
|
|
@@ -9768,7 +9847,7 @@ function defineStruct(fields, structDefOptions) {
|
|
|
9768
9847
|
const num = def.to(val[i]);
|
|
9769
9848
|
bufferView.setUint32(i * arrayElementSize, num, true);
|
|
9770
9849
|
}
|
|
9771
|
-
pointerPacker(view, off,
|
|
9850
|
+
pointerPacker(view, off, ptr2(buffer));
|
|
9772
9851
|
};
|
|
9773
9852
|
unpack = null;
|
|
9774
9853
|
needsLengthOf = true;
|
|
@@ -9785,7 +9864,7 @@ function defineStruct(fields, structDefOptions) {
|
|
|
9785
9864
|
for (let i = 0;i < val.length; i++) {
|
|
9786
9865
|
def.packInto(val[i], bufferView, i * arrayElementSize, options2);
|
|
9787
9866
|
}
|
|
9788
|
-
pointerPacker(view, off,
|
|
9867
|
+
pointerPacker(view, off, ptr2(buffer));
|
|
9789
9868
|
};
|
|
9790
9869
|
unpack = (view, off) => {
|
|
9791
9870
|
throw new Error("Not implemented yet");
|
|
@@ -9803,7 +9882,7 @@ function defineStruct(fields, structDefOptions) {
|
|
|
9803
9882
|
for (let i = 0;i < val.length; i++) {
|
|
9804
9883
|
primitivePack(bufferView, i * arrayElementSize, val[i]);
|
|
9805
9884
|
}
|
|
9806
|
-
pointerPacker(view, off,
|
|
9885
|
+
pointerPacker(view, off, ptr2(buffer));
|
|
9807
9886
|
};
|
|
9808
9887
|
unpack = null;
|
|
9809
9888
|
needsLengthOf = true;
|
|
@@ -9816,7 +9895,7 @@ function defineStruct(fields, structDefOptions) {
|
|
|
9816
9895
|
return;
|
|
9817
9896
|
}
|
|
9818
9897
|
const packedView = packObjectArray(val);
|
|
9819
|
-
pointerPacker(view, off,
|
|
9898
|
+
pointerPacker(view, off, ptr2(packedView.buffer));
|
|
9820
9899
|
};
|
|
9821
9900
|
unpack = () => {
|
|
9822
9901
|
throw new Error("not implemented yet");
|
|
@@ -10120,9 +10199,9 @@ function defineStruct(fields, structDefOptions) {
|
|
|
10120
10199
|
}
|
|
10121
10200
|
|
|
10122
10201
|
// src/zig-structs.ts
|
|
10123
|
-
import { ptr as
|
|
10124
|
-
var rgbaPackTransform = (rgba) => rgba ?
|
|
10125
|
-
var rgbaUnpackTransform = (
|
|
10202
|
+
import { ptr as ptr3, toArrayBuffer as toArrayBuffer3 } from "bun:ffi";
|
|
10203
|
+
var rgbaPackTransform = (rgba) => rgba ? ptr3(rgba.buffer) : null;
|
|
10204
|
+
var rgbaUnpackTransform = (ptr4) => ptr4 ? RGBA.fromArray(new Float32Array(toArrayBuffer3(ptr4))) : undefined;
|
|
10126
10205
|
var StyledChunkStruct = defineStruct([
|
|
10127
10206
|
["text", "char*"],
|
|
10128
10207
|
["text_len", "u64", { lengthOf: "text" }],
|
|
@@ -10180,6 +10259,7 @@ var TerminalCapabilitiesStruct = defineStruct([
|
|
|
10180
10259
|
["sync", "bool_u8"],
|
|
10181
10260
|
["bracketed_paste", "bool_u8"],
|
|
10182
10261
|
["hyperlinks", "bool_u8"],
|
|
10262
|
+
["osc52", "bool_u8"],
|
|
10183
10263
|
["explicit_cursor_positioning", "bool_u8"],
|
|
10184
10264
|
["term_name", "char*"],
|
|
10185
10265
|
["term_name_len", "u64", { lengthOf: "term_name" }],
|
|
@@ -10278,7 +10358,7 @@ function getOpenTUILib(libPath) {
|
|
|
10278
10358
|
returns: "void"
|
|
10279
10359
|
},
|
|
10280
10360
|
createRenderer: {
|
|
10281
|
-
args: ["u32", "u32", "bool"],
|
|
10361
|
+
args: ["u32", "u32", "bool", "bool"],
|
|
10282
10362
|
returns: "ptr"
|
|
10283
10363
|
},
|
|
10284
10364
|
destroyRenderer: {
|
|
@@ -10449,6 +10529,14 @@ function getOpenTUILib(libPath) {
|
|
|
10449
10529
|
args: ["ptr", "ptr", "usize"],
|
|
10450
10530
|
returns: "void"
|
|
10451
10531
|
},
|
|
10532
|
+
copyToClipboardOSC52: {
|
|
10533
|
+
args: ["ptr", "u8", "ptr", "usize"],
|
|
10534
|
+
returns: "bool"
|
|
10535
|
+
},
|
|
10536
|
+
clearClipboardOSC52: {
|
|
10537
|
+
args: ["ptr", "u8"],
|
|
10538
|
+
returns: "bool"
|
|
10539
|
+
},
|
|
10452
10540
|
bufferDrawSuperSampleBuffer: {
|
|
10453
10541
|
args: ["ptr", "u32", "u32", "ptr", "usize", "u8", "u32"],
|
|
10454
10542
|
returns: "void"
|
|
@@ -10457,6 +10545,14 @@ function getOpenTUILib(libPath) {
|
|
|
10457
10545
|
args: ["ptr", "ptr", "usize", "u32", "u32", "u32", "u32"],
|
|
10458
10546
|
returns: "void"
|
|
10459
10547
|
},
|
|
10548
|
+
bufferDrawGrayscaleBuffer: {
|
|
10549
|
+
args: ["ptr", "i32", "i32", "ptr", "u32", "u32", "ptr", "ptr"],
|
|
10550
|
+
returns: "void"
|
|
10551
|
+
},
|
|
10552
|
+
bufferDrawGrayscaleBufferSupersampled: {
|
|
10553
|
+
args: ["ptr", "i32", "i32", "ptr", "u32", "u32", "ptr", "ptr"],
|
|
10554
|
+
returns: "void"
|
|
10555
|
+
},
|
|
10460
10556
|
bufferDrawBox: {
|
|
10461
10557
|
args: ["ptr", "i32", "i32", "u32", "u32", "ptr", "u32", "ptr", "ptr", "ptr", "u32"],
|
|
10462
10558
|
returns: "void"
|
|
@@ -11022,7 +11118,7 @@ function getOpenTUILib(libPath) {
|
|
|
11022
11118
|
returns: "u64"
|
|
11023
11119
|
},
|
|
11024
11120
|
editorViewSetLocalSelection: {
|
|
11025
|
-
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr", "bool"],
|
|
11121
|
+
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr", "bool", "bool"],
|
|
11026
11122
|
returns: "bool"
|
|
11027
11123
|
},
|
|
11028
11124
|
editorViewUpdateSelection: {
|
|
@@ -11030,7 +11126,7 @@ function getOpenTUILib(libPath) {
|
|
|
11030
11126
|
returns: "void"
|
|
11031
11127
|
},
|
|
11032
11128
|
editorViewUpdateLocalSelection: {
|
|
11033
|
-
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr", "bool"],
|
|
11129
|
+
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr", "bool", "bool"],
|
|
11034
11130
|
returns: "bool"
|
|
11035
11131
|
},
|
|
11036
11132
|
editorViewResetLocalSelection: {
|
|
@@ -11401,8 +11497,10 @@ class FFIRenderLib {
|
|
|
11401
11497
|
setEventCallback(callbackPtr) {
|
|
11402
11498
|
this.opentui.symbols.setEventCallback(callbackPtr);
|
|
11403
11499
|
}
|
|
11404
|
-
createRenderer(width, height, options = {
|
|
11405
|
-
|
|
11500
|
+
createRenderer(width, height, options = {}) {
|
|
11501
|
+
const testing = options.testing ?? false;
|
|
11502
|
+
const remote = options.remote ?? false;
|
|
11503
|
+
return this.opentui.symbols.createRenderer(width, height, testing, remote);
|
|
11406
11504
|
}
|
|
11407
11505
|
destroyRenderer(renderer) {
|
|
11408
11506
|
this.opentui.symbols.destroyRenderer(renderer);
|
|
@@ -11441,32 +11539,32 @@ class FFIRenderLib {
|
|
|
11441
11539
|
return new OptimizedBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod: "unicode" });
|
|
11442
11540
|
}
|
|
11443
11541
|
bufferGetCharPtr(buffer) {
|
|
11444
|
-
const
|
|
11445
|
-
if (!
|
|
11542
|
+
const ptr5 = this.opentui.symbols.bufferGetCharPtr(buffer);
|
|
11543
|
+
if (!ptr5) {
|
|
11446
11544
|
throw new Error("Failed to get char pointer");
|
|
11447
11545
|
}
|
|
11448
|
-
return
|
|
11546
|
+
return ptr5;
|
|
11449
11547
|
}
|
|
11450
11548
|
bufferGetFgPtr(buffer) {
|
|
11451
|
-
const
|
|
11452
|
-
if (!
|
|
11549
|
+
const ptr5 = this.opentui.symbols.bufferGetFgPtr(buffer);
|
|
11550
|
+
if (!ptr5) {
|
|
11453
11551
|
throw new Error("Failed to get fg pointer");
|
|
11454
11552
|
}
|
|
11455
|
-
return
|
|
11553
|
+
return ptr5;
|
|
11456
11554
|
}
|
|
11457
11555
|
bufferGetBgPtr(buffer) {
|
|
11458
|
-
const
|
|
11459
|
-
if (!
|
|
11556
|
+
const ptr5 = this.opentui.symbols.bufferGetBgPtr(buffer);
|
|
11557
|
+
if (!ptr5) {
|
|
11460
11558
|
throw new Error("Failed to get bg pointer");
|
|
11461
11559
|
}
|
|
11462
|
-
return
|
|
11560
|
+
return ptr5;
|
|
11463
11561
|
}
|
|
11464
11562
|
bufferGetAttributesPtr(buffer) {
|
|
11465
|
-
const
|
|
11466
|
-
if (!
|
|
11563
|
+
const ptr5 = this.opentui.symbols.bufferGetAttributesPtr(buffer);
|
|
11564
|
+
if (!ptr5) {
|
|
11467
11565
|
throw new Error("Failed to get attributes pointer");
|
|
11468
11566
|
}
|
|
11469
|
-
return
|
|
11567
|
+
return ptr5;
|
|
11470
11568
|
}
|
|
11471
11569
|
bufferGetRespectAlpha(buffer) {
|
|
11472
11570
|
return this.opentui.symbols.bufferGetRespectAlpha(buffer);
|
|
@@ -11527,6 +11625,12 @@ class FFIRenderLib {
|
|
|
11527
11625
|
bufferDrawPackedBuffer(buffer, dataPtr, dataLen, posX, posY, terminalWidthCells, terminalHeightCells) {
|
|
11528
11626
|
this.opentui.symbols.bufferDrawPackedBuffer(buffer, dataPtr, dataLen, posX, posY, terminalWidthCells, terminalHeightCells);
|
|
11529
11627
|
}
|
|
11628
|
+
bufferDrawGrayscaleBuffer(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2, bg2) {
|
|
11629
|
+
this.opentui.symbols.bufferDrawGrayscaleBuffer(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2?.buffer ?? null, bg2?.buffer ?? null);
|
|
11630
|
+
}
|
|
11631
|
+
bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2, bg2) {
|
|
11632
|
+
this.opentui.symbols.bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2?.buffer ?? null, bg2?.buffer ?? null);
|
|
11633
|
+
}
|
|
11530
11634
|
bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, borderColor, backgroundColor, title) {
|
|
11531
11635
|
const titleBytes = title ? this.encoder.encode(title) : null;
|
|
11532
11636
|
const titleLen = title ? titleBytes.length : 0;
|
|
@@ -11566,7 +11670,7 @@ class FFIRenderLib {
|
|
|
11566
11670
|
}
|
|
11567
11671
|
getCursorState(renderer) {
|
|
11568
11672
|
const cursorBuffer = new ArrayBuffer(CursorStateStruct.size);
|
|
11569
|
-
this.opentui.symbols.getCursorState(renderer,
|
|
11673
|
+
this.opentui.symbols.getCursorState(renderer, ptr4(cursorBuffer));
|
|
11570
11674
|
const struct = CursorStateStruct.unpack(cursorBuffer);
|
|
11571
11675
|
const styleMap = {
|
|
11572
11676
|
0: "block",
|
|
@@ -11618,6 +11722,12 @@ class FFIRenderLib {
|
|
|
11618
11722
|
const titleBytes = this.encoder.encode(title);
|
|
11619
11723
|
this.opentui.symbols.setTerminalTitle(renderer, titleBytes, titleBytes.length);
|
|
11620
11724
|
}
|
|
11725
|
+
copyToClipboardOSC52(renderer, target, payload) {
|
|
11726
|
+
return this.opentui.symbols.copyToClipboardOSC52(renderer, target, payload, payload.length);
|
|
11727
|
+
}
|
|
11728
|
+
clearClipboardOSC52(renderer, target) {
|
|
11729
|
+
return this.opentui.symbols.clearClipboardOSC52(renderer, target);
|
|
11730
|
+
}
|
|
11621
11731
|
addToHitGrid(renderer, x, y, width, height, id) {
|
|
11622
11732
|
this.opentui.symbols.addToHitGrid(renderer, x, y, width, height, id);
|
|
11623
11733
|
}
|
|
@@ -11687,7 +11797,7 @@ class FFIRenderLib {
|
|
|
11687
11797
|
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
11688
11798
|
if (bytes.length === 0)
|
|
11689
11799
|
return;
|
|
11690
|
-
this.opentui.symbols.writeOut(renderer,
|
|
11800
|
+
this.opentui.symbols.writeOut(renderer, ptr4(bytes), bytes.length);
|
|
11691
11801
|
}
|
|
11692
11802
|
createTextBuffer(widthMethod) {
|
|
11693
11803
|
const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
|
|
@@ -11776,7 +11886,7 @@ class FFIRenderLib {
|
|
|
11776
11886
|
return chunk;
|
|
11777
11887
|
});
|
|
11778
11888
|
const chunksBuffer = StyledChunkStruct.packList(processedChunks);
|
|
11779
|
-
this.opentui.symbols.textBufferSetStyledText(buffer,
|
|
11889
|
+
this.opentui.symbols.textBufferSetStyledText(buffer, ptr4(chunksBuffer), processedChunks.length);
|
|
11780
11890
|
}
|
|
11781
11891
|
textBufferGetLineCount(buffer) {
|
|
11782
11892
|
return this.opentui.symbols.textBufferGetLineCount(buffer);
|
|
@@ -11787,7 +11897,7 @@ class FFIRenderLib {
|
|
|
11787
11897
|
}
|
|
11788
11898
|
getPlainTextBytes(buffer, maxLength) {
|
|
11789
11899
|
const outBuffer = new Uint8Array(maxLength);
|
|
11790
|
-
const actualLen = this.textBufferGetPlainText(buffer,
|
|
11900
|
+
const actualLen = this.textBufferGetPlainText(buffer, ptr4(outBuffer), maxLength);
|
|
11791
11901
|
if (actualLen === 0) {
|
|
11792
11902
|
return null;
|
|
11793
11903
|
}
|
|
@@ -11795,7 +11905,7 @@ class FFIRenderLib {
|
|
|
11795
11905
|
}
|
|
11796
11906
|
textBufferGetTextRange(buffer, startOffset, endOffset, maxLength) {
|
|
11797
11907
|
const outBuffer = new Uint8Array(maxLength);
|
|
11798
|
-
const actualLen = this.opentui.symbols.textBufferGetTextRange(buffer, startOffset, endOffset,
|
|
11908
|
+
const actualLen = this.opentui.symbols.textBufferGetTextRange(buffer, startOffset, endOffset, ptr4(outBuffer), maxLength);
|
|
11799
11909
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
11800
11910
|
if (len === 0) {
|
|
11801
11911
|
return null;
|
|
@@ -11804,7 +11914,7 @@ class FFIRenderLib {
|
|
|
11804
11914
|
}
|
|
11805
11915
|
textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, maxLength) {
|
|
11806
11916
|
const outBuffer = new Uint8Array(maxLength);
|
|
11807
|
-
const actualLen = this.opentui.symbols.textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol,
|
|
11917
|
+
const actualLen = this.opentui.symbols.textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, ptr4(outBuffer), maxLength);
|
|
11808
11918
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
11809
11919
|
if (len === 0) {
|
|
11810
11920
|
return null;
|
|
@@ -11874,7 +11984,7 @@ class FFIRenderLib {
|
|
|
11874
11984
|
}
|
|
11875
11985
|
textBufferViewGetLineInfo(view) {
|
|
11876
11986
|
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11877
|
-
this.textBufferViewGetLineInfoDirect(view,
|
|
11987
|
+
this.textBufferViewGetLineInfoDirect(view, ptr4(outBuffer));
|
|
11878
11988
|
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11879
11989
|
return {
|
|
11880
11990
|
maxLineWidth: struct.maxWidth,
|
|
@@ -11886,7 +11996,7 @@ class FFIRenderLib {
|
|
|
11886
11996
|
}
|
|
11887
11997
|
textBufferViewGetLogicalLineInfo(view) {
|
|
11888
11998
|
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11889
|
-
this.textBufferViewGetLogicalLineInfoDirect(view,
|
|
11999
|
+
this.textBufferViewGetLogicalLineInfoDirect(view, ptr4(outBuffer));
|
|
11890
12000
|
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11891
12001
|
return {
|
|
11892
12002
|
maxLineWidth: struct.maxWidth,
|
|
@@ -11915,7 +12025,7 @@ class FFIRenderLib {
|
|
|
11915
12025
|
}
|
|
11916
12026
|
textBufferViewGetSelectedTextBytes(view, maxLength) {
|
|
11917
12027
|
const outBuffer = new Uint8Array(maxLength);
|
|
11918
|
-
const actualLen = this.textBufferViewGetSelectedText(view,
|
|
12028
|
+
const actualLen = this.textBufferViewGetSelectedText(view, ptr4(outBuffer), maxLength);
|
|
11919
12029
|
if (actualLen === 0) {
|
|
11920
12030
|
return null;
|
|
11921
12031
|
}
|
|
@@ -11923,7 +12033,7 @@ class FFIRenderLib {
|
|
|
11923
12033
|
}
|
|
11924
12034
|
textBufferViewGetPlainTextBytes(view, maxLength) {
|
|
11925
12035
|
const outBuffer = new Uint8Array(maxLength);
|
|
11926
|
-
const actualLen = this.textBufferViewGetPlainText(view,
|
|
12036
|
+
const actualLen = this.textBufferViewGetPlainText(view, ptr4(outBuffer), maxLength);
|
|
11927
12037
|
if (actualLen === 0) {
|
|
11928
12038
|
return null;
|
|
11929
12039
|
}
|
|
@@ -11940,7 +12050,7 @@ class FFIRenderLib {
|
|
|
11940
12050
|
}
|
|
11941
12051
|
textBufferViewMeasureForDimensions(view, width, height) {
|
|
11942
12052
|
const resultBuffer = new ArrayBuffer(MeasureResultStruct.size);
|
|
11943
|
-
const resultPtr =
|
|
12053
|
+
const resultPtr = ptr4(new Uint8Array(resultBuffer));
|
|
11944
12054
|
const success = this.opentui.symbols.textBufferViewMeasureForDimensions(view, width, height, resultPtr);
|
|
11945
12055
|
if (!success) {
|
|
11946
12056
|
return null;
|
|
@@ -11950,11 +12060,11 @@ class FFIRenderLib {
|
|
|
11950
12060
|
}
|
|
11951
12061
|
textBufferAddHighlightByCharRange(buffer, highlight) {
|
|
11952
12062
|
const packedHighlight = HighlightStruct.pack(highlight);
|
|
11953
|
-
this.opentui.symbols.textBufferAddHighlightByCharRange(buffer,
|
|
12063
|
+
this.opentui.symbols.textBufferAddHighlightByCharRange(buffer, ptr4(packedHighlight));
|
|
11954
12064
|
}
|
|
11955
12065
|
textBufferAddHighlight(buffer, lineIdx, highlight) {
|
|
11956
12066
|
const packedHighlight = HighlightStruct.pack(highlight);
|
|
11957
|
-
this.opentui.symbols.textBufferAddHighlight(buffer, lineIdx,
|
|
12067
|
+
this.opentui.symbols.textBufferAddHighlight(buffer, lineIdx, ptr4(packedHighlight));
|
|
11958
12068
|
}
|
|
11959
12069
|
textBufferRemoveHighlightsByRef(buffer, hlRef) {
|
|
11960
12070
|
this.opentui.symbols.textBufferRemoveHighlightsByRef(buffer, hlRef);
|
|
@@ -11970,7 +12080,7 @@ class FFIRenderLib {
|
|
|
11970
12080
|
}
|
|
11971
12081
|
textBufferGetLineHighlights(buffer, lineIdx) {
|
|
11972
12082
|
const outCountBuf = new BigUint64Array(1);
|
|
11973
|
-
const nativePtr = this.opentui.symbols.textBufferGetLineHighlightsPtr(buffer, lineIdx,
|
|
12083
|
+
const nativePtr = this.opentui.symbols.textBufferGetLineHighlightsPtr(buffer, lineIdx, ptr4(outCountBuf));
|
|
11974
12084
|
if (!nativePtr)
|
|
11975
12085
|
return [];
|
|
11976
12086
|
const count = Number(outCountBuf[0]);
|
|
@@ -12014,7 +12124,7 @@ class FFIRenderLib {
|
|
|
12014
12124
|
const y = new Uint32Array(1);
|
|
12015
12125
|
const width = new Uint32Array(1);
|
|
12016
12126
|
const height = new Uint32Array(1);
|
|
12017
|
-
this.opentui.symbols.editorViewGetViewport(view,
|
|
12127
|
+
this.opentui.symbols.editorViewGetViewport(view, ptr4(x), ptr4(y), ptr4(width), ptr4(height));
|
|
12018
12128
|
return {
|
|
12019
12129
|
offsetX: x[0],
|
|
12020
12130
|
offsetY: y[0],
|
|
@@ -12044,7 +12154,7 @@ class FFIRenderLib {
|
|
|
12044
12154
|
}
|
|
12045
12155
|
editorViewGetLineInfo(view) {
|
|
12046
12156
|
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
12047
|
-
this.opentui.symbols.editorViewGetLineInfoDirect(view,
|
|
12157
|
+
this.opentui.symbols.editorViewGetLineInfoDirect(view, ptr4(outBuffer));
|
|
12048
12158
|
const struct = LineInfoStruct.unpack(outBuffer);
|
|
12049
12159
|
return {
|
|
12050
12160
|
maxLineWidth: struct.maxWidth,
|
|
@@ -12056,7 +12166,7 @@ class FFIRenderLib {
|
|
|
12056
12166
|
}
|
|
12057
12167
|
editorViewGetLogicalLineInfo(view) {
|
|
12058
12168
|
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
12059
|
-
this.opentui.symbols.editorViewGetLogicalLineInfoDirect(view,
|
|
12169
|
+
this.opentui.symbols.editorViewGetLogicalLineInfoDirect(view, ptr4(outBuffer));
|
|
12060
12170
|
const struct = LineInfoStruct.unpack(outBuffer);
|
|
12061
12171
|
return {
|
|
12062
12172
|
maxLineWidth: struct.maxWidth,
|
|
@@ -12091,7 +12201,7 @@ class FFIRenderLib {
|
|
|
12091
12201
|
}
|
|
12092
12202
|
editBufferGetText(buffer, maxLength) {
|
|
12093
12203
|
const outBuffer = new Uint8Array(maxLength);
|
|
12094
|
-
const actualLen = this.opentui.symbols.editBufferGetText(buffer,
|
|
12204
|
+
const actualLen = this.opentui.symbols.editBufferGetText(buffer, ptr4(outBuffer), maxLength);
|
|
12095
12205
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
12096
12206
|
if (len === 0)
|
|
12097
12207
|
return null;
|
|
@@ -12146,7 +12256,7 @@ class FFIRenderLib {
|
|
|
12146
12256
|
}
|
|
12147
12257
|
editBufferGetCursorPosition(buffer) {
|
|
12148
12258
|
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
12149
|
-
this.opentui.symbols.editBufferGetCursorPosition(buffer,
|
|
12259
|
+
this.opentui.symbols.editBufferGetCursorPosition(buffer, ptr4(cursorBuffer));
|
|
12150
12260
|
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
12151
12261
|
}
|
|
12152
12262
|
editBufferGetId(buffer) {
|
|
@@ -12164,7 +12274,7 @@ class FFIRenderLib {
|
|
|
12164
12274
|
}
|
|
12165
12275
|
editBufferUndo(buffer, maxLength) {
|
|
12166
12276
|
const outBuffer = new Uint8Array(maxLength);
|
|
12167
|
-
const actualLen = this.opentui.symbols.editBufferUndo(buffer,
|
|
12277
|
+
const actualLen = this.opentui.symbols.editBufferUndo(buffer, ptr4(outBuffer), maxLength);
|
|
12168
12278
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
12169
12279
|
if (len === 0)
|
|
12170
12280
|
return null;
|
|
@@ -12172,7 +12282,7 @@ class FFIRenderLib {
|
|
|
12172
12282
|
}
|
|
12173
12283
|
editBufferRedo(buffer, maxLength) {
|
|
12174
12284
|
const outBuffer = new Uint8Array(maxLength);
|
|
12175
|
-
const actualLen = this.opentui.symbols.editBufferRedo(buffer,
|
|
12285
|
+
const actualLen = this.opentui.symbols.editBufferRedo(buffer, ptr4(outBuffer), maxLength);
|
|
12176
12286
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
12177
12287
|
if (len === 0)
|
|
12178
12288
|
return null;
|
|
@@ -12192,22 +12302,22 @@ class FFIRenderLib {
|
|
|
12192
12302
|
}
|
|
12193
12303
|
editBufferGetNextWordBoundary(buffer) {
|
|
12194
12304
|
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
12195
|
-
this.opentui.symbols.editBufferGetNextWordBoundary(buffer,
|
|
12305
|
+
this.opentui.symbols.editBufferGetNextWordBoundary(buffer, ptr4(cursorBuffer));
|
|
12196
12306
|
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
12197
12307
|
}
|
|
12198
12308
|
editBufferGetPrevWordBoundary(buffer) {
|
|
12199
12309
|
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
12200
|
-
this.opentui.symbols.editBufferGetPrevWordBoundary(buffer,
|
|
12310
|
+
this.opentui.symbols.editBufferGetPrevWordBoundary(buffer, ptr4(cursorBuffer));
|
|
12201
12311
|
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
12202
12312
|
}
|
|
12203
12313
|
editBufferGetEOL(buffer) {
|
|
12204
12314
|
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
12205
|
-
this.opentui.symbols.editBufferGetEOL(buffer,
|
|
12315
|
+
this.opentui.symbols.editBufferGetEOL(buffer, ptr4(cursorBuffer));
|
|
12206
12316
|
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
12207
12317
|
}
|
|
12208
12318
|
editBufferOffsetToPosition(buffer, offset) {
|
|
12209
12319
|
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
12210
|
-
const success = this.opentui.symbols.editBufferOffsetToPosition(buffer, offset,
|
|
12320
|
+
const success = this.opentui.symbols.editBufferOffsetToPosition(buffer, offset, ptr4(cursorBuffer));
|
|
12211
12321
|
if (!success)
|
|
12212
12322
|
return null;
|
|
12213
12323
|
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
@@ -12220,7 +12330,7 @@ class FFIRenderLib {
|
|
|
12220
12330
|
}
|
|
12221
12331
|
editBufferGetTextRange(buffer, startOffset, endOffset, maxLength) {
|
|
12222
12332
|
const outBuffer = new Uint8Array(maxLength);
|
|
12223
|
-
const actualLen = this.opentui.symbols.editBufferGetTextRange(buffer, startOffset, endOffset,
|
|
12333
|
+
const actualLen = this.opentui.symbols.editBufferGetTextRange(buffer, startOffset, endOffset, ptr4(outBuffer), maxLength);
|
|
12224
12334
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
12225
12335
|
if (len === 0)
|
|
12226
12336
|
return null;
|
|
@@ -12228,7 +12338,7 @@ class FFIRenderLib {
|
|
|
12228
12338
|
}
|
|
12229
12339
|
editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, maxLength) {
|
|
12230
12340
|
const outBuffer = new Uint8Array(maxLength);
|
|
12231
|
-
const actualLen = this.opentui.symbols.editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol,
|
|
12341
|
+
const actualLen = this.opentui.symbols.editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, ptr4(outBuffer), maxLength);
|
|
12232
12342
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
12233
12343
|
if (len === 0)
|
|
12234
12344
|
return null;
|
|
@@ -12251,27 +12361,27 @@ class FFIRenderLib {
|
|
|
12251
12361
|
const end = Number(packedInfo & 0xffff_ffffn);
|
|
12252
12362
|
return { start, end };
|
|
12253
12363
|
}
|
|
12254
|
-
editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor) {
|
|
12364
|
+
editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor) {
|
|
12255
12365
|
const bg2 = bgColor ? bgColor.buffer : null;
|
|
12256
12366
|
const fg2 = fgColor ? fgColor.buffer : null;
|
|
12257
|
-
return this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor);
|
|
12367
|
+
return this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor, followCursor);
|
|
12258
12368
|
}
|
|
12259
12369
|
editorViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
12260
12370
|
const bg2 = bgColor ? bgColor.buffer : null;
|
|
12261
12371
|
const fg2 = fgColor ? fgColor.buffer : null;
|
|
12262
12372
|
this.opentui.symbols.editorViewUpdateSelection(view, end, bg2, fg2);
|
|
12263
12373
|
}
|
|
12264
|
-
editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor) {
|
|
12374
|
+
editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor) {
|
|
12265
12375
|
const bg2 = bgColor ? bgColor.buffer : null;
|
|
12266
12376
|
const fg2 = fgColor ? fgColor.buffer : null;
|
|
12267
|
-
return this.opentui.symbols.editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor);
|
|
12377
|
+
return this.opentui.symbols.editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor, followCursor);
|
|
12268
12378
|
}
|
|
12269
12379
|
editorViewResetLocalSelection(view) {
|
|
12270
12380
|
this.opentui.symbols.editorViewResetLocalSelection(view);
|
|
12271
12381
|
}
|
|
12272
12382
|
editorViewGetSelectedTextBytes(view, maxLength) {
|
|
12273
12383
|
const outBuffer = new Uint8Array(maxLength);
|
|
12274
|
-
const actualLen = this.opentui.symbols.editorViewGetSelectedTextBytes(view,
|
|
12384
|
+
const actualLen = this.opentui.symbols.editorViewGetSelectedTextBytes(view, ptr4(outBuffer), maxLength);
|
|
12275
12385
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
12276
12386
|
if (len === 0)
|
|
12277
12387
|
return null;
|
|
@@ -12280,12 +12390,12 @@ class FFIRenderLib {
|
|
|
12280
12390
|
editorViewGetCursor(view) {
|
|
12281
12391
|
const row = new Uint32Array(1);
|
|
12282
12392
|
const col = new Uint32Array(1);
|
|
12283
|
-
this.opentui.symbols.editorViewGetCursor(view,
|
|
12393
|
+
this.opentui.symbols.editorViewGetCursor(view, ptr4(row), ptr4(col));
|
|
12284
12394
|
return { row: row[0], col: col[0] };
|
|
12285
12395
|
}
|
|
12286
12396
|
editorViewGetText(view, maxLength) {
|
|
12287
12397
|
const outBuffer = new Uint8Array(maxLength);
|
|
12288
|
-
const actualLen = this.opentui.symbols.editorViewGetText(view,
|
|
12398
|
+
const actualLen = this.opentui.symbols.editorViewGetText(view, ptr4(outBuffer), maxLength);
|
|
12289
12399
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
12290
12400
|
if (len === 0)
|
|
12291
12401
|
return null;
|
|
@@ -12293,7 +12403,7 @@ class FFIRenderLib {
|
|
|
12293
12403
|
}
|
|
12294
12404
|
editorViewGetVisualCursor(view) {
|
|
12295
12405
|
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
12296
|
-
this.opentui.symbols.editorViewGetVisualCursor(view,
|
|
12406
|
+
this.opentui.symbols.editorViewGetVisualCursor(view, ptr4(cursorBuffer));
|
|
12297
12407
|
return VisualCursorStruct.unpack(cursorBuffer);
|
|
12298
12408
|
}
|
|
12299
12409
|
editorViewMoveUpVisual(view) {
|
|
@@ -12310,27 +12420,27 @@ class FFIRenderLib {
|
|
|
12310
12420
|
}
|
|
12311
12421
|
editorViewGetNextWordBoundary(view) {
|
|
12312
12422
|
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
12313
|
-
this.opentui.symbols.editorViewGetNextWordBoundary(view,
|
|
12423
|
+
this.opentui.symbols.editorViewGetNextWordBoundary(view, ptr4(cursorBuffer));
|
|
12314
12424
|
return VisualCursorStruct.unpack(cursorBuffer);
|
|
12315
12425
|
}
|
|
12316
12426
|
editorViewGetPrevWordBoundary(view) {
|
|
12317
12427
|
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
12318
|
-
this.opentui.symbols.editorViewGetPrevWordBoundary(view,
|
|
12428
|
+
this.opentui.symbols.editorViewGetPrevWordBoundary(view, ptr4(cursorBuffer));
|
|
12319
12429
|
return VisualCursorStruct.unpack(cursorBuffer);
|
|
12320
12430
|
}
|
|
12321
12431
|
editorViewGetEOL(view) {
|
|
12322
12432
|
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
12323
|
-
this.opentui.symbols.editorViewGetEOL(view,
|
|
12433
|
+
this.opentui.symbols.editorViewGetEOL(view, ptr4(cursorBuffer));
|
|
12324
12434
|
return VisualCursorStruct.unpack(cursorBuffer);
|
|
12325
12435
|
}
|
|
12326
12436
|
editorViewGetVisualSOL(view) {
|
|
12327
12437
|
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
12328
|
-
this.opentui.symbols.editorViewGetVisualSOL(view,
|
|
12438
|
+
this.opentui.symbols.editorViewGetVisualSOL(view, ptr4(cursorBuffer));
|
|
12329
12439
|
return VisualCursorStruct.unpack(cursorBuffer);
|
|
12330
12440
|
}
|
|
12331
12441
|
editorViewGetVisualEOL(view) {
|
|
12332
12442
|
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
12333
|
-
this.opentui.symbols.editorViewGetVisualEOL(view,
|
|
12443
|
+
this.opentui.symbols.editorViewGetVisualEOL(view, ptr4(cursorBuffer));
|
|
12334
12444
|
return VisualCursorStruct.unpack(cursorBuffer);
|
|
12335
12445
|
}
|
|
12336
12446
|
bufferPushScissorRect(buffer, x, y, width, height) {
|
|
@@ -12356,7 +12466,7 @@ class FFIRenderLib {
|
|
|
12356
12466
|
}
|
|
12357
12467
|
getTerminalCapabilities(renderer) {
|
|
12358
12468
|
const capsBuffer = new ArrayBuffer(TerminalCapabilitiesStruct.size);
|
|
12359
|
-
this.opentui.symbols.getTerminalCapabilities(renderer,
|
|
12469
|
+
this.opentui.symbols.getTerminalCapabilities(renderer, ptr4(capsBuffer));
|
|
12360
12470
|
const caps = TerminalCapabilitiesStruct.unpack(capsBuffer);
|
|
12361
12471
|
return {
|
|
12362
12472
|
kitty_keyboard: caps.kitty_keyboard,
|
|
@@ -12372,6 +12482,7 @@ class FFIRenderLib {
|
|
|
12372
12482
|
sync: caps.sync,
|
|
12373
12483
|
bracketed_paste: caps.bracketed_paste,
|
|
12374
12484
|
hyperlinks: caps.hyperlinks,
|
|
12485
|
+
osc52: caps.osc52,
|
|
12375
12486
|
explicit_cursor_positioning: caps.explicit_cursor_positioning,
|
|
12376
12487
|
terminal: {
|
|
12377
12488
|
name: caps.term_name ?? "",
|
|
@@ -12389,7 +12500,7 @@ class FFIRenderLib {
|
|
|
12389
12500
|
const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
|
|
12390
12501
|
const outPtrBuffer = new ArrayBuffer(8);
|
|
12391
12502
|
const outLenBuffer = new ArrayBuffer(8);
|
|
12392
|
-
const success = this.opentui.symbols.encodeUnicode(textBytes, textBytes.length,
|
|
12503
|
+
const success = this.opentui.symbols.encodeUnicode(textBytes, textBytes.length, ptr4(outPtrBuffer), ptr4(outLenBuffer), widthMethodCode);
|
|
12393
12504
|
if (!success) {
|
|
12394
12505
|
return null;
|
|
12395
12506
|
}
|
|
@@ -12443,7 +12554,7 @@ class FFIRenderLib {
|
|
|
12443
12554
|
return;
|
|
12444
12555
|
}
|
|
12445
12556
|
const chunksBuffer = StyledChunkStruct.packList(nonEmptyChunks);
|
|
12446
|
-
this.opentui.symbols.editorViewSetPlaceholderStyledText(view,
|
|
12557
|
+
this.opentui.symbols.editorViewSetPlaceholderStyledText(view, ptr4(chunksBuffer), nonEmptyChunks.length);
|
|
12447
12558
|
}
|
|
12448
12559
|
editorViewSetTabIndicator(view, indicator) {
|
|
12449
12560
|
this.opentui.symbols.editorViewSetTabIndicator(view, indicator);
|
|
@@ -12498,9 +12609,9 @@ class TextBuffer {
|
|
|
12498
12609
|
_textBytes;
|
|
12499
12610
|
_memId;
|
|
12500
12611
|
_appendedChunks = [];
|
|
12501
|
-
constructor(lib,
|
|
12612
|
+
constructor(lib, ptr5) {
|
|
12502
12613
|
this.lib = lib;
|
|
12503
|
-
this.bufferPtr =
|
|
12614
|
+
this.bufferPtr = ptr5;
|
|
12504
12615
|
}
|
|
12505
12616
|
static create(widthMethod) {
|
|
12506
12617
|
const lib = resolveRenderLib();
|
|
@@ -12903,6 +13014,9 @@ class Renderable extends BaseRenderable {
|
|
|
12903
13014
|
get focusable() {
|
|
12904
13015
|
return this._focusable;
|
|
12905
13016
|
}
|
|
13017
|
+
set focusable(value) {
|
|
13018
|
+
this._focusable = value;
|
|
13019
|
+
}
|
|
12906
13020
|
get ctx() {
|
|
12907
13021
|
return this._ctx;
|
|
12908
13022
|
}
|
|
@@ -13597,7 +13711,16 @@ class Renderable extends BaseRenderable {
|
|
|
13597
13711
|
return -1;
|
|
13598
13712
|
}
|
|
13599
13713
|
if (!this.renderableMapById.has(anchor.id)) {
|
|
13600
|
-
|
|
13714
|
+
if (true) {
|
|
13715
|
+
console.warn(`Anchor with id ${anchor.id} does not exist within the parent ${this.id}, skipping insertBefore`);
|
|
13716
|
+
}
|
|
13717
|
+
return -1;
|
|
13718
|
+
}
|
|
13719
|
+
if (renderable === anchor || renderable.id === anchor.id) {
|
|
13720
|
+
if (true) {
|
|
13721
|
+
console.warn(`Anchor is the same as the node ${renderable.id} being inserted, skipping insertBefore`);
|
|
13722
|
+
}
|
|
13723
|
+
return -1;
|
|
13601
13724
|
}
|
|
13602
13725
|
if (renderable.parent === this) {
|
|
13603
13726
|
this.yogaNode.removeChild(renderable.getLayoutNode());
|
|
@@ -14428,7 +14551,7 @@ class TerminalConsole extends EventEmitter8 {
|
|
|
14428
14551
|
_entryListener;
|
|
14429
14552
|
_selectionStart = null;
|
|
14430
14553
|
_selectionEnd = null;
|
|
14431
|
-
|
|
14554
|
+
_isDragging = false;
|
|
14432
14555
|
_copyButtonBounds = {
|
|
14433
14556
|
x: 0,
|
|
14434
14557
|
y: 0,
|
|
@@ -15025,7 +15148,7 @@ class TerminalConsole extends EventEmitter8 {
|
|
|
15025
15148
|
clearSelection() {
|
|
15026
15149
|
this._selectionStart = null;
|
|
15027
15150
|
this._selectionEnd = null;
|
|
15028
|
-
this.
|
|
15151
|
+
this._isDragging = false;
|
|
15029
15152
|
this.stopAutoScroll();
|
|
15030
15153
|
}
|
|
15031
15154
|
stopAutoScroll() {
|
|
@@ -15138,11 +15261,11 @@ class TerminalConsole extends EventEmitter8 {
|
|
|
15138
15261
|
this.clearSelection();
|
|
15139
15262
|
this._selectionStart = { line: lineIndex, col: colIndex };
|
|
15140
15263
|
this._selectionEnd = { line: lineIndex, col: colIndex };
|
|
15141
|
-
this.
|
|
15264
|
+
this._isDragging = true;
|
|
15142
15265
|
this.markNeedsRerender();
|
|
15143
15266
|
return true;
|
|
15144
15267
|
}
|
|
15145
|
-
if (event.type === "drag" && this.
|
|
15268
|
+
if (event.type === "drag" && this._isDragging) {
|
|
15146
15269
|
this._selectionEnd = { line: lineIndex, col: colIndex };
|
|
15147
15270
|
const logAreaHeight = Math.max(1, this.consoleHeight - 1);
|
|
15148
15271
|
const relativeY = localY - 1;
|
|
@@ -15157,9 +15280,9 @@ class TerminalConsole extends EventEmitter8 {
|
|
|
15157
15280
|
return true;
|
|
15158
15281
|
}
|
|
15159
15282
|
if (event.type === "up") {
|
|
15160
|
-
if (this.
|
|
15283
|
+
if (this._isDragging) {
|
|
15161
15284
|
this._selectionEnd = { line: lineIndex, col: colIndex };
|
|
15162
|
-
this.
|
|
15285
|
+
this._isDragging = false;
|
|
15163
15286
|
this.stopAutoScroll();
|
|
15164
15287
|
this.markNeedsRerender();
|
|
15165
15288
|
}
|
|
@@ -15217,6 +15340,38 @@ var ANSI = {
|
|
|
15217
15340
|
bracketedPasteEnd: "\x1B[201~"
|
|
15218
15341
|
};
|
|
15219
15342
|
|
|
15343
|
+
// src/lib/clipboard.ts
|
|
15344
|
+
function encodeOsc52Payload(text, encoder2 = new TextEncoder) {
|
|
15345
|
+
const base64 = Buffer.from(text).toString("base64");
|
|
15346
|
+
return encoder2.encode(base64);
|
|
15347
|
+
}
|
|
15348
|
+
|
|
15349
|
+
class Clipboard {
|
|
15350
|
+
lib;
|
|
15351
|
+
rendererPtr;
|
|
15352
|
+
constructor(lib, rendererPtr) {
|
|
15353
|
+
this.lib = lib;
|
|
15354
|
+
this.rendererPtr = rendererPtr;
|
|
15355
|
+
}
|
|
15356
|
+
copyToClipboardOSC52(text, target = 0 /* Clipboard */) {
|
|
15357
|
+
if (!this.isOsc52Supported()) {
|
|
15358
|
+
return false;
|
|
15359
|
+
}
|
|
15360
|
+
const payload = encodeOsc52Payload(text, this.lib.encoder);
|
|
15361
|
+
return this.lib.copyToClipboardOSC52(this.rendererPtr, target, payload);
|
|
15362
|
+
}
|
|
15363
|
+
clearClipboardOSC52(target = 0 /* Clipboard */) {
|
|
15364
|
+
if (!this.isOsc52Supported()) {
|
|
15365
|
+
return false;
|
|
15366
|
+
}
|
|
15367
|
+
return this.lib.clearClipboardOSC52(this.rendererPtr, target);
|
|
15368
|
+
}
|
|
15369
|
+
isOsc52Supported() {
|
|
15370
|
+
const caps = this.lib.getTerminalCapabilities(this.rendererPtr);
|
|
15371
|
+
return Boolean(caps?.osc52);
|
|
15372
|
+
}
|
|
15373
|
+
}
|
|
15374
|
+
|
|
15220
15375
|
// src/renderer.ts
|
|
15221
15376
|
import { EventEmitter as EventEmitter9 } from "events";
|
|
15222
15377
|
|
|
@@ -15384,6 +15539,12 @@ registerEnvVar({
|
|
|
15384
15539
|
type: "boolean",
|
|
15385
15540
|
default: false
|
|
15386
15541
|
});
|
|
15542
|
+
registerEnvVar({
|
|
15543
|
+
name: "OTUI_SHOW_STATS",
|
|
15544
|
+
description: "Show the debug overlay at startup.",
|
|
15545
|
+
type: "boolean",
|
|
15546
|
+
default: false
|
|
15547
|
+
});
|
|
15387
15548
|
var KITTY_FLAG_DISAMBIGUATE = 1;
|
|
15388
15549
|
var KITTY_FLAG_EVENT_TYPES = 2;
|
|
15389
15550
|
var KITTY_FLAG_ALTERNATE_KEYS = 4;
|
|
@@ -15421,7 +15582,7 @@ class MouseEvent {
|
|
|
15421
15582
|
modifiers;
|
|
15422
15583
|
scroll;
|
|
15423
15584
|
target;
|
|
15424
|
-
|
|
15585
|
+
isDragging;
|
|
15425
15586
|
_propagationStopped = false;
|
|
15426
15587
|
_defaultPrevented = false;
|
|
15427
15588
|
get propagationStopped() {
|
|
@@ -15439,7 +15600,7 @@ class MouseEvent {
|
|
|
15439
15600
|
this.modifiers = attributes.modifiers;
|
|
15440
15601
|
this.scroll = attributes.scroll;
|
|
15441
15602
|
this.source = attributes.source;
|
|
15442
|
-
this.
|
|
15603
|
+
this.isDragging = attributes.isDragging;
|
|
15443
15604
|
}
|
|
15444
15605
|
stopPropagation() {
|
|
15445
15606
|
this._propagationStopped = true;
|
|
@@ -15484,7 +15645,7 @@ async function createCliRenderer(config = {}) {
|
|
|
15484
15645
|
const height = stdout.rows || 24;
|
|
15485
15646
|
const renderHeight = config.experimental_splitHeight && config.experimental_splitHeight > 0 ? config.experimental_splitHeight : height;
|
|
15486
15647
|
const ziglib = resolveRenderLib();
|
|
15487
|
-
const rendererPtr = ziglib.createRenderer(width, renderHeight);
|
|
15648
|
+
const rendererPtr = ziglib.createRenderer(width, renderHeight, { remote: config.remote ?? false });
|
|
15488
15649
|
if (!rendererPtr) {
|
|
15489
15650
|
throw new Error("Failed to create renderer");
|
|
15490
15651
|
}
|
|
@@ -15573,7 +15734,7 @@ class CliRenderer extends EventEmitter9 {
|
|
|
15573
15734
|
frameCallbackTime: 0
|
|
15574
15735
|
};
|
|
15575
15736
|
debugOverlay = {
|
|
15576
|
-
enabled:
|
|
15737
|
+
enabled: env.OTUI_SHOW_STATS,
|
|
15577
15738
|
corner: 3 /* bottomRight */
|
|
15578
15739
|
};
|
|
15579
15740
|
_console;
|
|
@@ -15594,6 +15755,7 @@ class CliRenderer extends EventEmitter9 {
|
|
|
15594
15755
|
lastOverRenderable;
|
|
15595
15756
|
currentSelection = null;
|
|
15596
15757
|
selectionContainers = [];
|
|
15758
|
+
clipboard;
|
|
15597
15759
|
_splitHeight = 0;
|
|
15598
15760
|
renderOffset = 0;
|
|
15599
15761
|
_terminalWidth = 0;
|
|
@@ -15676,8 +15838,8 @@ Captured output:
|
|
|
15676
15838
|
this.stdout = stdout;
|
|
15677
15839
|
this.realStdoutWrite = stdout.write;
|
|
15678
15840
|
this.lib = lib;
|
|
15679
|
-
this._terminalWidth = stdout.columns;
|
|
15680
|
-
this._terminalHeight = stdout.rows;
|
|
15841
|
+
this._terminalWidth = stdout.columns ?? width;
|
|
15842
|
+
this._terminalHeight = stdout.rows ?? height;
|
|
15681
15843
|
this.width = width;
|
|
15682
15844
|
this.height = height;
|
|
15683
15845
|
this._useThread = config.useThread === undefined ? false : config.useThread;
|
|
@@ -15690,7 +15852,18 @@ Captured output:
|
|
|
15690
15852
|
}
|
|
15691
15853
|
this.rendererPtr = rendererPtr;
|
|
15692
15854
|
this.exitOnCtrlC = config.exitOnCtrlC === undefined ? true : config.exitOnCtrlC;
|
|
15693
|
-
this.exitSignals = config.exitSignals || [
|
|
15855
|
+
this.exitSignals = config.exitSignals || [
|
|
15856
|
+
"SIGINT",
|
|
15857
|
+
"SIGTERM",
|
|
15858
|
+
"SIGQUIT",
|
|
15859
|
+
"SIGABRT",
|
|
15860
|
+
"SIGHUP",
|
|
15861
|
+
"SIGBREAK",
|
|
15862
|
+
"SIGPIPE",
|
|
15863
|
+
"SIGBUS",
|
|
15864
|
+
"SIGFPE"
|
|
15865
|
+
];
|
|
15866
|
+
this.clipboard = new Clipboard(this.lib, this.rendererPtr);
|
|
15694
15867
|
this.resizeDebounceDelay = config.debounceDelay || 100;
|
|
15695
15868
|
this.targetFps = config.targetFps || 30;
|
|
15696
15869
|
this.maxFps = config.maxFps || 60;
|
|
@@ -16054,6 +16227,14 @@ Captured output:
|
|
|
16054
16227
|
this._terminalIsSetup = true;
|
|
16055
16228
|
this.lib.setupTerminal(this.rendererPtr, this._useAlternateScreen);
|
|
16056
16229
|
this._capabilities = this.lib.getTerminalCapabilities(this.rendererPtr);
|
|
16230
|
+
if (this.debugOverlay.enabled) {
|
|
16231
|
+
this.lib.setDebugOverlay(this.rendererPtr, true, this.debugOverlay.corner);
|
|
16232
|
+
if (!this.memorySnapshotInterval) {
|
|
16233
|
+
this.memorySnapshotInterval = 3000;
|
|
16234
|
+
this.startMemorySnapshotTimer();
|
|
16235
|
+
this.automaticMemorySnapshot = true;
|
|
16236
|
+
}
|
|
16237
|
+
}
|
|
16057
16238
|
this.capabilityTimeoutId = setTimeout(() => {
|
|
16058
16239
|
this.capabilityTimeoutId = null;
|
|
16059
16240
|
this.removeInputHandler(this.capabilityHandler);
|
|
@@ -16141,6 +16322,21 @@ Captured output:
|
|
|
16141
16322
|
this._keyHandler.processPaste(data);
|
|
16142
16323
|
});
|
|
16143
16324
|
}
|
|
16325
|
+
dispatchMouseEvent(target, attributes) {
|
|
16326
|
+
const event = new MouseEvent(target, attributes);
|
|
16327
|
+
target.processMouseEvent(event);
|
|
16328
|
+
if (event.type === "down" && event.button === 0 /* LEFT */ && !event.defaultPrevented) {
|
|
16329
|
+
let current = target;
|
|
16330
|
+
while (current) {
|
|
16331
|
+
if (current.focusable) {
|
|
16332
|
+
current.focus();
|
|
16333
|
+
break;
|
|
16334
|
+
}
|
|
16335
|
+
current = current.parent;
|
|
16336
|
+
}
|
|
16337
|
+
}
|
|
16338
|
+
return event;
|
|
16339
|
+
}
|
|
16144
16340
|
handleMouseData(data) {
|
|
16145
16341
|
const mouseEvent = this.mouseParser.parseMouseEvent(data);
|
|
16146
16342
|
if (mouseEvent) {
|
|
@@ -16176,25 +16372,24 @@ Captured output:
|
|
|
16176
16372
|
const sameElement = maybeRenderableId === this.lastOverRenderableNum;
|
|
16177
16373
|
this.lastOverRenderableNum = maybeRenderableId;
|
|
16178
16374
|
const maybeRenderable = Renderable.renderablesByNumber.get(maybeRenderableId);
|
|
16179
|
-
if (mouseEvent.type === "down" && mouseEvent.button === 0 /* LEFT */ && !this.currentSelection?.
|
|
16375
|
+
if (mouseEvent.type === "down" && mouseEvent.button === 0 /* LEFT */ && !this.currentSelection?.isDragging && !mouseEvent.modifiers.ctrl) {
|
|
16180
16376
|
if (maybeRenderable && maybeRenderable.selectable && !maybeRenderable.isDestroyed && maybeRenderable.shouldStartSelection(mouseEvent.x, mouseEvent.y)) {
|
|
16181
16377
|
this.startSelection(maybeRenderable, mouseEvent.x, mouseEvent.y);
|
|
16182
|
-
|
|
16183
|
-
maybeRenderable.processMouseEvent(event2);
|
|
16378
|
+
this.dispatchMouseEvent(maybeRenderable, mouseEvent);
|
|
16184
16379
|
return true;
|
|
16185
16380
|
}
|
|
16186
16381
|
}
|
|
16187
|
-
if (mouseEvent.type === "drag" && this.currentSelection?.
|
|
16382
|
+
if (mouseEvent.type === "drag" && this.currentSelection?.isDragging) {
|
|
16188
16383
|
this.updateSelection(maybeRenderable, mouseEvent.x, mouseEvent.y);
|
|
16189
16384
|
if (maybeRenderable) {
|
|
16190
|
-
const event2 = new MouseEvent(maybeRenderable, { ...mouseEvent,
|
|
16385
|
+
const event2 = new MouseEvent(maybeRenderable, { ...mouseEvent, isDragging: true });
|
|
16191
16386
|
maybeRenderable.processMouseEvent(event2);
|
|
16192
16387
|
}
|
|
16193
16388
|
return true;
|
|
16194
16389
|
}
|
|
16195
|
-
if (mouseEvent.type === "up" && this.currentSelection?.
|
|
16390
|
+
if (mouseEvent.type === "up" && this.currentSelection?.isDragging) {
|
|
16196
16391
|
if (maybeRenderable) {
|
|
16197
|
-
const event2 = new MouseEvent(maybeRenderable, { ...mouseEvent,
|
|
16392
|
+
const event2 = new MouseEvent(maybeRenderable, { ...mouseEvent, isDragging: true });
|
|
16198
16393
|
maybeRenderable.processMouseEvent(event2);
|
|
16199
16394
|
}
|
|
16200
16395
|
this.finishSelection();
|
|
@@ -16202,7 +16397,7 @@ Captured output:
|
|
|
16202
16397
|
}
|
|
16203
16398
|
if (mouseEvent.type === "down" && mouseEvent.button === 0 /* LEFT */ && this.currentSelection) {
|
|
16204
16399
|
if (mouseEvent.modifiers.ctrl) {
|
|
16205
|
-
this.currentSelection.
|
|
16400
|
+
this.currentSelection.isDragging = true;
|
|
16206
16401
|
this.updateSelection(maybeRenderable, mouseEvent.x, mouseEvent.y);
|
|
16207
16402
|
return true;
|
|
16208
16403
|
}
|
|
@@ -16244,15 +16439,14 @@ Captured output:
|
|
|
16244
16439
|
this.setCapturedRenderable(undefined);
|
|
16245
16440
|
this.requestRender();
|
|
16246
16441
|
}
|
|
16247
|
-
let event
|
|
16442
|
+
let event;
|
|
16248
16443
|
if (maybeRenderable) {
|
|
16249
16444
|
if (mouseEvent.type === "drag" && mouseEvent.button === 0 /* LEFT */) {
|
|
16250
16445
|
this.setCapturedRenderable(maybeRenderable);
|
|
16251
16446
|
} else {
|
|
16252
16447
|
this.setCapturedRenderable(undefined);
|
|
16253
16448
|
}
|
|
16254
|
-
event =
|
|
16255
|
-
maybeRenderable.processMouseEvent(event);
|
|
16449
|
+
event = this.dispatchMouseEvent(maybeRenderable, mouseEvent);
|
|
16256
16450
|
} else {
|
|
16257
16451
|
this.setCapturedRenderable(undefined);
|
|
16258
16452
|
this.lastOverRenderable = undefined;
|
|
@@ -16417,6 +16611,15 @@ Captured output:
|
|
|
16417
16611
|
setTerminalTitle(title) {
|
|
16418
16612
|
this.lib.setTerminalTitle(this.rendererPtr, title);
|
|
16419
16613
|
}
|
|
16614
|
+
copyToClipboardOSC52(text, target) {
|
|
16615
|
+
return this.clipboard.copyToClipboardOSC52(text, target);
|
|
16616
|
+
}
|
|
16617
|
+
clearClipboardOSC52(target) {
|
|
16618
|
+
return this.clipboard.clearClipboardOSC52(target);
|
|
16619
|
+
}
|
|
16620
|
+
isOsc52Supported() {
|
|
16621
|
+
return this._capabilities?.osc52 ?? this.clipboard.isOsc52Supported();
|
|
16622
|
+
}
|
|
16420
16623
|
dumpHitGrid() {
|
|
16421
16624
|
this.lib.dumpHitGrid(this.rendererPtr);
|
|
16422
16625
|
}
|
|
@@ -16805,10 +17008,13 @@ Captured output:
|
|
|
16805
17008
|
this.currentSelection.isStart = true;
|
|
16806
17009
|
this.notifySelectablesOfSelectionChange();
|
|
16807
17010
|
}
|
|
16808
|
-
updateSelection(currentRenderable, x, y) {
|
|
17011
|
+
updateSelection(currentRenderable, x, y, options) {
|
|
16809
17012
|
if (this.currentSelection) {
|
|
16810
17013
|
this.currentSelection.isStart = false;
|
|
16811
17014
|
this.currentSelection.focus = { x, y };
|
|
17015
|
+
if (options?.finishDragging) {
|
|
17016
|
+
this.currentSelection.isDragging = false;
|
|
17017
|
+
}
|
|
16812
17018
|
if (this.selectionContainers.length > 0) {
|
|
16813
17019
|
const currentContainer = this.selectionContainers[this.selectionContainers.length - 1];
|
|
16814
17020
|
if (!currentRenderable || !this.isWithinContainer(currentRenderable, currentContainer)) {
|
|
@@ -16829,7 +17035,7 @@ Captured output:
|
|
|
16829
17035
|
}
|
|
16830
17036
|
}
|
|
16831
17037
|
requestSelectionUpdate() {
|
|
16832
|
-
if (this.currentSelection?.
|
|
17038
|
+
if (this.currentSelection?.isDragging) {
|
|
16833
17039
|
const pointer = this._latestPointer;
|
|
16834
17040
|
const maybeRenderableId = this.hitTest(pointer.x, pointer.y);
|
|
16835
17041
|
const maybeRenderable = Renderable.renderablesByNumber.get(maybeRenderableId);
|
|
@@ -16847,7 +17053,7 @@ Captured output:
|
|
|
16847
17053
|
}
|
|
16848
17054
|
finishSelection() {
|
|
16849
17055
|
if (this.currentSelection) {
|
|
16850
|
-
this.currentSelection.
|
|
17056
|
+
this.currentSelection.isDragging = false;
|
|
16851
17057
|
this.emit("selection", this.currentSelection);
|
|
16852
17058
|
this.notifySelectablesOfSelectionChange();
|
|
16853
17059
|
}
|
|
@@ -16919,7 +17125,7 @@ Captured output:
|
|
|
16919
17125
|
}
|
|
16920
17126
|
}
|
|
16921
17127
|
|
|
16922
|
-
export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, exports_src, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, createTextAttributes, attributesWithLink, getLinkId, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, link, t, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, StdinBuffer, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extToFiletype, pathToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, ANSI, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingKey, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
|
|
17128
|
+
export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, createTextAttributes, attributesWithLink, getLinkId, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, link, t, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, StdinBuffer, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extToFiletype, pathToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, ANSI, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingKey, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
|
|
16923
17129
|
|
|
16924
|
-
//# debugId=
|
|
16925
|
-
//# sourceMappingURL=index-
|
|
17130
|
+
//# debugId=B39292D59871DD3764756E2164756E21
|
|
17131
|
+
//# sourceMappingURL=index-phtsmwj4.js.map
|