@opentui/core 0.1.49 → 0.1.51
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/README.md +5 -3
- package/edit-buffer.d.ts +1 -0
- package/editor-view.d.ts +5 -0
- package/{index-ztfy2qy3.js → index-adyhxxja.js} +208 -81
- package/{index-ztfy2qy3.js.map → index-adyhxxja.js.map} +10 -10
- package/index.js +2476 -310
- package/index.js.map +23 -11
- package/lib/terminal-palette.d.ts +7 -2
- package/package.json +8 -7
- package/renderables/Diff.d.ts +121 -0
- package/renderables/EditBufferRenderable.d.ts +7 -2
- package/renderables/LineNumberRenderable.d.ts +71 -0
- package/renderables/TextBufferRenderable.d.ts +17 -5
- package/renderables/Textarea.d.ts +7 -4
- package/renderables/index.d.ts +2 -0
- package/testing.js +1 -1
- package/text-buffer-view.d.ts +5 -0
- package/text-buffer.d.ts +1 -0
- package/types.d.ts +12 -0
- package/zig-structs.d.ts +10 -0
- package/zig.d.ts +7 -6
package/3d.js
CHANGED
package/README.md
CHANGED
|
@@ -5,9 +5,11 @@ development and is not ready for production use.
|
|
|
5
5
|
|
|
6
6
|
## Documentation
|
|
7
7
|
|
|
8
|
-
- [Getting Started](docs/getting-started.md)
|
|
9
|
-
- [
|
|
10
|
-
- [
|
|
8
|
+
- [Getting Started](docs/getting-started.md) - API and usage guide
|
|
9
|
+
- [Development Guide](docs/development.md) - Building, testing, and contributing
|
|
10
|
+
- [Tree-Sitter](docs/tree-sitter.md) - Syntax highlighting integration
|
|
11
|
+
- [Renderables vs Constructs](docs/renderables-vs-constructs.md) - Understanding the component model
|
|
12
|
+
- [Environment Variables](docs/env-vars.md) - Configuration options
|
|
11
13
|
|
|
12
14
|
## Install
|
|
13
15
|
|
package/edit-buffer.d.ts
CHANGED
package/editor-view.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare class EditorView {
|
|
|
15
15
|
private editBuffer;
|
|
16
16
|
private _destroyed;
|
|
17
17
|
private _extmarksController?;
|
|
18
|
+
private _textBufferViewPtr?;
|
|
18
19
|
constructor(lib: RenderLib, ptr: Pointer, editBuffer: EditBuffer);
|
|
19
20
|
static create(editBuffer: EditBuffer, viewportWidth: number, viewportHeight: number): EditorView;
|
|
20
21
|
private guard;
|
|
@@ -59,5 +60,9 @@ export declare class EditorView {
|
|
|
59
60
|
}[]): void;
|
|
60
61
|
setTabIndicator(indicator: string | number): void;
|
|
61
62
|
setTabIndicatorColor(color: RGBA): void;
|
|
63
|
+
measureForDimensions(width: number, height: number): {
|
|
64
|
+
lineCount: number;
|
|
65
|
+
maxWidth: number;
|
|
66
|
+
} | null;
|
|
62
67
|
destroy(): void;
|
|
63
68
|
}
|
|
@@ -1877,7 +1877,72 @@ function fromKittyMods(mod) {
|
|
|
1877
1877
|
numLock: !!(mod & 128)
|
|
1878
1878
|
};
|
|
1879
1879
|
}
|
|
1880
|
+
var functionalKeyMap = {
|
|
1881
|
+
A: "up",
|
|
1882
|
+
B: "down",
|
|
1883
|
+
C: "right",
|
|
1884
|
+
D: "left",
|
|
1885
|
+
H: "home",
|
|
1886
|
+
F: "end",
|
|
1887
|
+
P: "f1",
|
|
1888
|
+
Q: "f2",
|
|
1889
|
+
R: "f3",
|
|
1890
|
+
S: "f4"
|
|
1891
|
+
};
|
|
1892
|
+
function parseKittyFunctionalKey(sequence) {
|
|
1893
|
+
const functionalRe = /^\x1b\[1;(\d+):(\d+)([A-Z])$/;
|
|
1894
|
+
const match = functionalRe.exec(sequence);
|
|
1895
|
+
if (!match)
|
|
1896
|
+
return null;
|
|
1897
|
+
const modifierStr = match[1];
|
|
1898
|
+
const eventTypeStr = match[2];
|
|
1899
|
+
const keyChar = match[3];
|
|
1900
|
+
const keyName = functionalKeyMap[keyChar];
|
|
1901
|
+
if (!keyName)
|
|
1902
|
+
return null;
|
|
1903
|
+
const key = {
|
|
1904
|
+
name: keyName,
|
|
1905
|
+
ctrl: false,
|
|
1906
|
+
meta: false,
|
|
1907
|
+
shift: false,
|
|
1908
|
+
option: false,
|
|
1909
|
+
number: false,
|
|
1910
|
+
sequence,
|
|
1911
|
+
raw: sequence,
|
|
1912
|
+
eventType: "press",
|
|
1913
|
+
source: "kitty",
|
|
1914
|
+
super: false,
|
|
1915
|
+
hyper: false,
|
|
1916
|
+
capsLock: false,
|
|
1917
|
+
numLock: false
|
|
1918
|
+
};
|
|
1919
|
+
if (modifierStr) {
|
|
1920
|
+
const modifierMask = parseInt(modifierStr, 10);
|
|
1921
|
+
if (!isNaN(modifierMask) && modifierMask > 1) {
|
|
1922
|
+
const mods = fromKittyMods(modifierMask - 1);
|
|
1923
|
+
key.shift = mods.shift;
|
|
1924
|
+
key.ctrl = mods.ctrl;
|
|
1925
|
+
key.meta = mods.alt || mods.meta;
|
|
1926
|
+
key.option = mods.alt;
|
|
1927
|
+
key.super = mods.super;
|
|
1928
|
+
key.hyper = mods.hyper;
|
|
1929
|
+
key.capsLock = mods.capsLock;
|
|
1930
|
+
key.numLock = mods.numLock;
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
if (eventTypeStr === "1" || !eventTypeStr) {
|
|
1934
|
+
key.eventType = "press";
|
|
1935
|
+
} else if (eventTypeStr === "2") {
|
|
1936
|
+
key.eventType = "repeat";
|
|
1937
|
+
} else if (eventTypeStr === "3") {
|
|
1938
|
+
key.eventType = "release";
|
|
1939
|
+
}
|
|
1940
|
+
return key;
|
|
1941
|
+
}
|
|
1880
1942
|
function parseKittyKeyboard(sequence) {
|
|
1943
|
+
const functionalResult = parseKittyFunctionalKey(sequence);
|
|
1944
|
+
if (functionalResult)
|
|
1945
|
+
return functionalResult;
|
|
1881
1946
|
const kittyRe = /^\x1b\[([^\x1b]+)u$/;
|
|
1882
1947
|
const match = kittyRe.exec(sequence);
|
|
1883
1948
|
if (!match)
|
|
@@ -2316,25 +2381,34 @@ class KeyHandler extends EventEmitter {
|
|
|
2316
2381
|
if (!parsedKey) {
|
|
2317
2382
|
return false;
|
|
2318
2383
|
}
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2384
|
+
try {
|
|
2385
|
+
switch (parsedKey.eventType) {
|
|
2386
|
+
case "press":
|
|
2387
|
+
this.emit("keypress", new KeyEvent(parsedKey));
|
|
2388
|
+
break;
|
|
2389
|
+
case "repeat":
|
|
2390
|
+
this.emit("keyrepeat", new KeyEvent(parsedKey));
|
|
2391
|
+
break;
|
|
2392
|
+
case "release":
|
|
2393
|
+
this.emit("keyrelease", new KeyEvent(parsedKey));
|
|
2394
|
+
break;
|
|
2395
|
+
default:
|
|
2396
|
+
this.emit("keypress", new KeyEvent(parsedKey));
|
|
2397
|
+
break;
|
|
2398
|
+
}
|
|
2399
|
+
} catch (error) {
|
|
2400
|
+
console.error(`[KeyHandler] Error processing input:`, error);
|
|
2401
|
+
return true;
|
|
2332
2402
|
}
|
|
2333
2403
|
return true;
|
|
2334
2404
|
}
|
|
2335
2405
|
processPaste(data) {
|
|
2336
|
-
|
|
2337
|
-
|
|
2406
|
+
try {
|
|
2407
|
+
const cleanedData = Bun.stripANSI(data);
|
|
2408
|
+
this.emit("paste", new PasteEvent(cleanedData));
|
|
2409
|
+
} catch (error) {
|
|
2410
|
+
console.error(`[KeyHandler] Error processing paste:`, error);
|
|
2411
|
+
}
|
|
2338
2412
|
}
|
|
2339
2413
|
}
|
|
2340
2414
|
|
|
@@ -2347,8 +2421,14 @@ class InternalKeyHandler extends KeyHandler {
|
|
|
2347
2421
|
return this.emitWithPriority(event, ...args);
|
|
2348
2422
|
}
|
|
2349
2423
|
emitWithPriority(event, ...args) {
|
|
2350
|
-
|
|
2424
|
+
let hasGlobalListeners = false;
|
|
2425
|
+
try {
|
|
2426
|
+
hasGlobalListeners = super.emit(event, ...args);
|
|
2427
|
+
} catch (error) {
|
|
2428
|
+
console.error(`[KeyHandler] Error in global ${event} handler:`, error);
|
|
2429
|
+
}
|
|
2351
2430
|
const renderableSet = this.renderableHandlers.get(event);
|
|
2431
|
+
const renderableHandlers = renderableSet && renderableSet.size > 0 ? [...renderableSet] : [];
|
|
2352
2432
|
let hasRenderableListeners = false;
|
|
2353
2433
|
if (renderableSet && renderableSet.size > 0) {
|
|
2354
2434
|
hasRenderableListeners = true;
|
|
@@ -2357,8 +2437,12 @@ class InternalKeyHandler extends KeyHandler {
|
|
|
2357
2437
|
if (keyEvent.defaultPrevented)
|
|
2358
2438
|
return hasGlobalListeners || hasRenderableListeners;
|
|
2359
2439
|
}
|
|
2360
|
-
for (const handler of
|
|
2361
|
-
|
|
2440
|
+
for (const handler of renderableHandlers) {
|
|
2441
|
+
try {
|
|
2442
|
+
handler(...args);
|
|
2443
|
+
} catch (error) {
|
|
2444
|
+
console.error(`[KeyHandler] Error in renderable ${event} handler:`, error);
|
|
2445
|
+
}
|
|
2362
2446
|
}
|
|
2363
2447
|
}
|
|
2364
2448
|
return hasGlobalListeners || hasRenderableListeners;
|
|
@@ -8781,6 +8865,10 @@ function toHex(r, g, b, hex6) {
|
|
|
8781
8865
|
return `#${scaleComponent(r)}${scaleComponent(g)}${scaleComponent(b)}`;
|
|
8782
8866
|
return "#000000";
|
|
8783
8867
|
}
|
|
8868
|
+
function wrapForTmux(osc) {
|
|
8869
|
+
const escaped = osc.replace(/\x1b/g, "\x1B\x1B");
|
|
8870
|
+
return `\x1BPtmux;${escaped}\x1B\\`;
|
|
8871
|
+
}
|
|
8784
8872
|
|
|
8785
8873
|
class TerminalPalette {
|
|
8786
8874
|
stdin;
|
|
@@ -8788,10 +8876,16 @@ class TerminalPalette {
|
|
|
8788
8876
|
writeFn;
|
|
8789
8877
|
activeListeners = [];
|
|
8790
8878
|
activeTimers = [];
|
|
8791
|
-
|
|
8879
|
+
inTmux;
|
|
8880
|
+
constructor(stdin, stdout, writeFn, isTmux) {
|
|
8792
8881
|
this.stdin = stdin;
|
|
8793
8882
|
this.stdout = stdout;
|
|
8794
8883
|
this.writeFn = writeFn || ((data) => stdout.write(data));
|
|
8884
|
+
this.inTmux = isTmux ?? false;
|
|
8885
|
+
}
|
|
8886
|
+
writeOsc(osc) {
|
|
8887
|
+
const data = this.inTmux ? wrapForTmux(osc) : osc;
|
|
8888
|
+
return this.writeFn(data);
|
|
8795
8889
|
}
|
|
8796
8890
|
cleanup() {
|
|
8797
8891
|
for (const { event, handler } of this.activeListeners) {
|
|
@@ -8836,7 +8930,7 @@ class TerminalPalette {
|
|
|
8836
8930
|
this.activeTimers.push(timer);
|
|
8837
8931
|
inp.on("data", onData);
|
|
8838
8932
|
this.activeListeners.push({ event: "data", handler: onData });
|
|
8839
|
-
this.
|
|
8933
|
+
this.writeOsc("\x1B]4;0;?\x07");
|
|
8840
8934
|
});
|
|
8841
8935
|
}
|
|
8842
8936
|
async queryPalette(indices, timeoutMs = 1200) {
|
|
@@ -8903,7 +8997,7 @@ class TerminalPalette {
|
|
|
8903
8997
|
this.activeTimers.push(timer);
|
|
8904
8998
|
inp.on("data", onData);
|
|
8905
8999
|
this.activeListeners.push({ event: "data", handler: onData });
|
|
8906
|
-
this.
|
|
9000
|
+
this.writeOsc(indices.map((i) => `\x1B]4;${i};?\x07`).join(""));
|
|
8907
9001
|
});
|
|
8908
9002
|
}
|
|
8909
9003
|
async querySpecialColors(timeoutMs = 1200) {
|
|
@@ -8978,7 +9072,7 @@ class TerminalPalette {
|
|
|
8978
9072
|
this.activeTimers.push(timer);
|
|
8979
9073
|
inp.on("data", onData);
|
|
8980
9074
|
this.activeListeners.push({ event: "data", handler: onData });
|
|
8981
|
-
this.
|
|
9075
|
+
this.writeOsc([
|
|
8982
9076
|
"\x1B]10;?\x07",
|
|
8983
9077
|
"\x1B]11;?\x07",
|
|
8984
9078
|
"\x1B]12;?\x07",
|
|
@@ -9027,8 +9121,8 @@ class TerminalPalette {
|
|
|
9027
9121
|
};
|
|
9028
9122
|
}
|
|
9029
9123
|
}
|
|
9030
|
-
function createTerminalPalette(stdin, stdout, writeFn) {
|
|
9031
|
-
return new TerminalPalette(stdin, stdout, writeFn);
|
|
9124
|
+
function createTerminalPalette(stdin, stdout, writeFn, isTmux) {
|
|
9125
|
+
return new TerminalPalette(stdin, stdout, writeFn, isTmux);
|
|
9032
9126
|
}
|
|
9033
9127
|
// src/zig.ts
|
|
9034
9128
|
import { dlopen, toArrayBuffer as toArrayBuffer4, JSCallback, ptr as ptr3 } from "bun:ffi";
|
|
@@ -9932,6 +10026,21 @@ var EncodedCharStruct = defineStruct([
|
|
|
9932
10026
|
["width", "u8"],
|
|
9933
10027
|
["char", "u32"]
|
|
9934
10028
|
]);
|
|
10029
|
+
var LineInfoStruct = defineStruct([
|
|
10030
|
+
["starts", ["u32"]],
|
|
10031
|
+
["startsLen", "u32", { lengthOf: "starts" }],
|
|
10032
|
+
["widths", ["u32"]],
|
|
10033
|
+
["widthsLen", "u32", { lengthOf: "widths" }],
|
|
10034
|
+
["sources", ["u32"]],
|
|
10035
|
+
["sourcesLen", "u32", { lengthOf: "sources" }],
|
|
10036
|
+
["wraps", ["u32"]],
|
|
10037
|
+
["wrapsLen", "u32", { lengthOf: "wraps" }],
|
|
10038
|
+
["maxWidth", "u32"]
|
|
10039
|
+
]);
|
|
10040
|
+
var MeasureResultStruct = defineStruct([
|
|
10041
|
+
["lineCount", "u32"],
|
|
10042
|
+
["maxWidth", "u32"]
|
|
10043
|
+
]);
|
|
9935
10044
|
|
|
9936
10045
|
// src/zig.ts
|
|
9937
10046
|
var module = await import(`@opentui/core-${process.platform}-${process.arch}/index.ts`);
|
|
@@ -10381,17 +10490,21 @@ function getOpenTUILib(libPath) {
|
|
|
10381
10490
|
args: ["ptr", "u32", "u32"],
|
|
10382
10491
|
returns: "void"
|
|
10383
10492
|
},
|
|
10493
|
+
textBufferViewSetViewport: {
|
|
10494
|
+
args: ["ptr", "u32", "u32", "u32", "u32"],
|
|
10495
|
+
returns: "void"
|
|
10496
|
+
},
|
|
10384
10497
|
textBufferViewGetVirtualLineCount: {
|
|
10385
10498
|
args: ["ptr"],
|
|
10386
10499
|
returns: "u32"
|
|
10387
10500
|
},
|
|
10388
10501
|
textBufferViewGetLineInfoDirect: {
|
|
10389
|
-
args: ["ptr", "ptr"
|
|
10390
|
-
returns: "
|
|
10502
|
+
args: ["ptr", "ptr"],
|
|
10503
|
+
returns: "void"
|
|
10391
10504
|
},
|
|
10392
10505
|
textBufferViewGetLogicalLineInfoDirect: {
|
|
10393
|
-
args: ["ptr", "ptr"
|
|
10394
|
-
returns: "
|
|
10506
|
+
args: ["ptr", "ptr"],
|
|
10507
|
+
returns: "void"
|
|
10395
10508
|
},
|
|
10396
10509
|
textBufferViewGetSelectedText: {
|
|
10397
10510
|
args: ["ptr", "ptr", "usize"],
|
|
@@ -10409,6 +10522,10 @@ function getOpenTUILib(libPath) {
|
|
|
10409
10522
|
args: ["ptr", "ptr"],
|
|
10410
10523
|
returns: "void"
|
|
10411
10524
|
},
|
|
10525
|
+
textBufferViewMeasureForDimensions: {
|
|
10526
|
+
args: ["ptr", "u32", "u32", "ptr"],
|
|
10527
|
+
returns: "bool"
|
|
10528
|
+
},
|
|
10412
10529
|
bufferDrawTextBufferView: {
|
|
10413
10530
|
args: ["ptr", "ptr", "i32", "i32"],
|
|
10414
10531
|
returns: "void"
|
|
@@ -10454,12 +10571,12 @@ function getOpenTUILib(libPath) {
|
|
|
10454
10571
|
returns: "ptr"
|
|
10455
10572
|
},
|
|
10456
10573
|
editorViewGetLineInfoDirect: {
|
|
10457
|
-
args: ["ptr", "ptr"
|
|
10458
|
-
returns: "
|
|
10574
|
+
args: ["ptr", "ptr"],
|
|
10575
|
+
returns: "void"
|
|
10459
10576
|
},
|
|
10460
10577
|
editorViewGetLogicalLineInfoDirect: {
|
|
10461
|
-
args: ["ptr", "ptr"
|
|
10462
|
-
returns: "
|
|
10578
|
+
args: ["ptr", "ptr"],
|
|
10579
|
+
returns: "void"
|
|
10463
10580
|
},
|
|
10464
10581
|
createEditBuffer: {
|
|
10465
10582
|
args: ["u8"],
|
|
@@ -11362,42 +11479,41 @@ class FFIRenderLib {
|
|
|
11362
11479
|
textBufferViewSetViewportSize(view, width, height) {
|
|
11363
11480
|
this.opentui.symbols.textBufferViewSetViewportSize(view, width, height);
|
|
11364
11481
|
}
|
|
11482
|
+
textBufferViewSetViewport(view, x, y, width, height) {
|
|
11483
|
+
this.opentui.symbols.textBufferViewSetViewport(view, x, y, width, height);
|
|
11484
|
+
}
|
|
11365
11485
|
textBufferViewGetLineInfo(view) {
|
|
11366
|
-
const
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
}
|
|
11370
|
-
const lineStarts = new Uint32Array(lineCount);
|
|
11371
|
-
const lineWidths = new Uint32Array(lineCount);
|
|
11372
|
-
const maxLineWidth = this.textBufferViewGetLineInfoDirect(view, ptr3(lineStarts), ptr3(lineWidths));
|
|
11486
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11487
|
+
this.textBufferViewGetLineInfoDirect(view, ptr3(outBuffer));
|
|
11488
|
+
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11373
11489
|
return {
|
|
11374
|
-
maxLineWidth,
|
|
11375
|
-
lineStarts:
|
|
11376
|
-
lineWidths:
|
|
11490
|
+
maxLineWidth: struct.maxWidth,
|
|
11491
|
+
lineStarts: struct.starts,
|
|
11492
|
+
lineWidths: struct.widths,
|
|
11493
|
+
lineSources: struct.sources,
|
|
11494
|
+
lineWraps: struct.wraps
|
|
11377
11495
|
};
|
|
11378
11496
|
}
|
|
11379
11497
|
textBufferViewGetLogicalLineInfo(view) {
|
|
11380
|
-
const
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
}
|
|
11384
|
-
const lineStarts = new Uint32Array(lineCount);
|
|
11385
|
-
const lineWidths = new Uint32Array(lineCount);
|
|
11386
|
-
const maxLineWidth = this.textBufferViewGetLogicalLineInfoDirect(view, ptr3(lineStarts), ptr3(lineWidths));
|
|
11498
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11499
|
+
this.textBufferViewGetLogicalLineInfoDirect(view, ptr3(outBuffer));
|
|
11500
|
+
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11387
11501
|
return {
|
|
11388
|
-
maxLineWidth,
|
|
11389
|
-
lineStarts:
|
|
11390
|
-
lineWidths:
|
|
11502
|
+
maxLineWidth: struct.maxWidth,
|
|
11503
|
+
lineStarts: struct.starts,
|
|
11504
|
+
lineWidths: struct.widths,
|
|
11505
|
+
lineSources: struct.sources,
|
|
11506
|
+
lineWraps: struct.wraps
|
|
11391
11507
|
};
|
|
11392
11508
|
}
|
|
11393
11509
|
textBufferViewGetLineCount(view) {
|
|
11394
11510
|
return this.opentui.symbols.textBufferViewGetVirtualLineCount(view);
|
|
11395
11511
|
}
|
|
11396
|
-
textBufferViewGetLineInfoDirect(view,
|
|
11397
|
-
|
|
11512
|
+
textBufferViewGetLineInfoDirect(view, outPtr) {
|
|
11513
|
+
this.opentui.symbols.textBufferViewGetLineInfoDirect(view, outPtr);
|
|
11398
11514
|
}
|
|
11399
|
-
textBufferViewGetLogicalLineInfoDirect(view,
|
|
11400
|
-
|
|
11515
|
+
textBufferViewGetLogicalLineInfoDirect(view, outPtr) {
|
|
11516
|
+
this.opentui.symbols.textBufferViewGetLogicalLineInfoDirect(view, outPtr);
|
|
11401
11517
|
}
|
|
11402
11518
|
textBufferViewGetSelectedText(view, outPtr, maxLen) {
|
|
11403
11519
|
const result = this.opentui.symbols.textBufferViewGetSelectedText(view, outPtr, maxLen);
|
|
@@ -11429,6 +11545,16 @@ class FFIRenderLib {
|
|
|
11429
11545
|
textBufferViewSetTabIndicatorColor(view, color) {
|
|
11430
11546
|
this.opentui.symbols.textBufferViewSetTabIndicatorColor(view, color.buffer);
|
|
11431
11547
|
}
|
|
11548
|
+
textBufferViewMeasureForDimensions(view, width, height) {
|
|
11549
|
+
const resultBuffer = new ArrayBuffer(MeasureResultStruct.size);
|
|
11550
|
+
const resultPtr = ptr3(new Uint8Array(resultBuffer));
|
|
11551
|
+
const success = this.opentui.symbols.textBufferViewMeasureForDimensions(view, width, height, resultPtr);
|
|
11552
|
+
if (!success) {
|
|
11553
|
+
return null;
|
|
11554
|
+
}
|
|
11555
|
+
const result = MeasureResultStruct.unpack(resultBuffer);
|
|
11556
|
+
return result;
|
|
11557
|
+
}
|
|
11432
11558
|
textBufferAddHighlightByCharRange(buffer, highlight) {
|
|
11433
11559
|
const packedHighlight = HighlightStruct.pack(highlight);
|
|
11434
11560
|
this.opentui.symbols.textBufferAddHighlightByCharRange(buffer, ptr3(packedHighlight));
|
|
@@ -11521,31 +11647,27 @@ class FFIRenderLib {
|
|
|
11521
11647
|
return result;
|
|
11522
11648
|
}
|
|
11523
11649
|
editorViewGetLineInfo(view) {
|
|
11524
|
-
const
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
}
|
|
11528
|
-
const lineStarts = new Uint32Array(lineCount);
|
|
11529
|
-
const lineWidths = new Uint32Array(lineCount);
|
|
11530
|
-
const maxLineWidth = this.opentui.symbols.editorViewGetLineInfoDirect(view, ptr3(lineStarts), ptr3(lineWidths));
|
|
11650
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11651
|
+
this.opentui.symbols.editorViewGetLineInfoDirect(view, ptr3(outBuffer));
|
|
11652
|
+
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11531
11653
|
return {
|
|
11532
|
-
maxLineWidth,
|
|
11533
|
-
lineStarts:
|
|
11534
|
-
lineWidths:
|
|
11654
|
+
maxLineWidth: struct.maxWidth,
|
|
11655
|
+
lineStarts: struct.starts,
|
|
11656
|
+
lineWidths: struct.widths,
|
|
11657
|
+
lineSources: struct.sources,
|
|
11658
|
+
lineWraps: struct.wraps
|
|
11535
11659
|
};
|
|
11536
11660
|
}
|
|
11537
11661
|
editorViewGetLogicalLineInfo(view) {
|
|
11538
|
-
const
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
}
|
|
11542
|
-
const lineStarts = new Uint32Array(lineCount);
|
|
11543
|
-
const lineWidths = new Uint32Array(lineCount);
|
|
11544
|
-
const maxLineWidth = this.opentui.symbols.editorViewGetLogicalLineInfoDirect(view, ptr3(lineStarts), ptr3(lineWidths));
|
|
11662
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11663
|
+
this.opentui.symbols.editorViewGetLogicalLineInfoDirect(view, ptr3(outBuffer));
|
|
11664
|
+
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11545
11665
|
return {
|
|
11546
|
-
maxLineWidth,
|
|
11547
|
-
lineStarts:
|
|
11548
|
-
lineWidths:
|
|
11666
|
+
maxLineWidth: struct.maxWidth,
|
|
11667
|
+
lineStarts: struct.starts,
|
|
11668
|
+
lineWidths: struct.widths,
|
|
11669
|
+
lineSources: struct.sources,
|
|
11670
|
+
lineWraps: struct.wraps
|
|
11549
11671
|
};
|
|
11550
11672
|
}
|
|
11551
11673
|
createEditBuffer(widthMethod) {
|
|
@@ -12016,6 +12138,10 @@ class TextBuffer {
|
|
|
12016
12138
|
this.guard();
|
|
12017
12139
|
this.lib.textBufferResetDefaults(this.bufferPtr);
|
|
12018
12140
|
}
|
|
12141
|
+
getLineCount() {
|
|
12142
|
+
this.guard();
|
|
12143
|
+
return this.lib.textBufferGetLineCount(this.bufferPtr);
|
|
12144
|
+
}
|
|
12019
12145
|
get length() {
|
|
12020
12146
|
this.guard();
|
|
12021
12147
|
return this._length;
|
|
@@ -14878,7 +15004,7 @@ Captured output:
|
|
|
14878
15004
|
this.mouseParser.reset();
|
|
14879
15005
|
this.lib.disableMouse(this.rendererPtr);
|
|
14880
15006
|
}
|
|
14881
|
-
enableKittyKeyboard(flags =
|
|
15007
|
+
enableKittyKeyboard(flags = 3) {
|
|
14882
15008
|
this.lib.enableKittyKeyboard(this.rendererPtr, flags);
|
|
14883
15009
|
}
|
|
14884
15010
|
disableKittyKeyboard() {
|
|
@@ -15645,7 +15771,8 @@ Captured output:
|
|
|
15645
15771
|
return this._paletteDetectionPromise;
|
|
15646
15772
|
}
|
|
15647
15773
|
if (!this._paletteDetector) {
|
|
15648
|
-
|
|
15774
|
+
const isTmux = this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux");
|
|
15775
|
+
this._paletteDetector = createTerminalPalette(this.stdin, this.stdout, this.writeOut.bind(this), isTmux);
|
|
15649
15776
|
}
|
|
15650
15777
|
this._paletteDetectionPromise = this._paletteDetector.detect(options).then((result) => {
|
|
15651
15778
|
this._cachedPalette = result;
|
|
@@ -15656,7 +15783,7 @@ Captured output:
|
|
|
15656
15783
|
}
|
|
15657
15784
|
}
|
|
15658
15785
|
|
|
15659
|
-
export { __toESM, __commonJS, __export, __require, Edge, Gutter, exports_src, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, DebugOverlayCorner, createTextAttributes, 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, t, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, StdinBuffer, parseAlign, 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, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
|
|
15786
|
+
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, DebugOverlayCorner, createTextAttributes, 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, t, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, StdinBuffer, parseAlign, 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, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
|
|
15660
15787
|
|
|
15661
|
-
//# debugId=
|
|
15662
|
-
//# sourceMappingURL=index-
|
|
15788
|
+
//# debugId=1A5789A06EEF6A6764756E2164756E21
|
|
15789
|
+
//# sourceMappingURL=index-adyhxxja.js.map
|