@opentui/core 0.1.50 → 0.1.52
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-vhxgbbed.js} +211 -83
- package/{index-ztfy2qy3.js.map → index-vhxgbbed.js.map} +11 -11
- package/index.js +2476 -309
- package/index.js.map +23 -11
- package/lib/KeyHandler.d.ts +1 -1
- package/lib/parse.keypress.d.ts +1 -0
- 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,73 @@ 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 = "press";
|
|
1937
|
+
key.repeated = true;
|
|
1938
|
+
} else if (eventTypeStr === "3") {
|
|
1939
|
+
key.eventType = "release";
|
|
1940
|
+
}
|
|
1941
|
+
return key;
|
|
1942
|
+
}
|
|
1880
1943
|
function parseKittyKeyboard(sequence) {
|
|
1944
|
+
const functionalResult = parseKittyFunctionalKey(sequence);
|
|
1945
|
+
if (functionalResult)
|
|
1946
|
+
return functionalResult;
|
|
1881
1947
|
const kittyRe = /^\x1b\[([^\x1b]+)u$/;
|
|
1882
1948
|
const match = kittyRe.exec(sequence);
|
|
1883
1949
|
if (!match)
|
|
@@ -1960,7 +2026,8 @@ function parseKittyKeyboard(sequence) {
|
|
|
1960
2026
|
if (eventTypeStr === "1" || !eventTypeStr) {
|
|
1961
2027
|
key.eventType = "press";
|
|
1962
2028
|
} else if (eventTypeStr === "2") {
|
|
1963
|
-
key.eventType = "
|
|
2029
|
+
key.eventType = "press";
|
|
2030
|
+
key.repeated = true;
|
|
1964
2031
|
} else if (eventTypeStr === "3") {
|
|
1965
2032
|
key.eventType = "release";
|
|
1966
2033
|
} else {
|
|
@@ -2264,6 +2331,7 @@ class KeyEvent {
|
|
|
2264
2331
|
capsLock;
|
|
2265
2332
|
numLock;
|
|
2266
2333
|
baseCode;
|
|
2334
|
+
repeated;
|
|
2267
2335
|
_defaultPrevented = false;
|
|
2268
2336
|
constructor(key) {
|
|
2269
2337
|
this.name = key.name;
|
|
@@ -2282,6 +2350,7 @@ class KeyEvent {
|
|
|
2282
2350
|
this.capsLock = key.capsLock;
|
|
2283
2351
|
this.numLock = key.numLock;
|
|
2284
2352
|
this.baseCode = key.baseCode;
|
|
2353
|
+
this.repeated = key.repeated;
|
|
2285
2354
|
}
|
|
2286
2355
|
get defaultPrevented() {
|
|
2287
2356
|
return this._defaultPrevented;
|
|
@@ -2316,25 +2385,31 @@ class KeyHandler extends EventEmitter {
|
|
|
2316
2385
|
if (!parsedKey) {
|
|
2317
2386
|
return false;
|
|
2318
2387
|
}
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2388
|
+
try {
|
|
2389
|
+
switch (parsedKey.eventType) {
|
|
2390
|
+
case "press":
|
|
2391
|
+
this.emit("keypress", new KeyEvent(parsedKey));
|
|
2392
|
+
break;
|
|
2393
|
+
case "release":
|
|
2394
|
+
this.emit("keyrelease", new KeyEvent(parsedKey));
|
|
2395
|
+
break;
|
|
2396
|
+
default:
|
|
2397
|
+
this.emit("keypress", new KeyEvent(parsedKey));
|
|
2398
|
+
break;
|
|
2399
|
+
}
|
|
2400
|
+
} catch (error) {
|
|
2401
|
+
console.error(`[KeyHandler] Error processing input:`, error);
|
|
2402
|
+
return true;
|
|
2332
2403
|
}
|
|
2333
2404
|
return true;
|
|
2334
2405
|
}
|
|
2335
2406
|
processPaste(data) {
|
|
2336
|
-
|
|
2337
|
-
|
|
2407
|
+
try {
|
|
2408
|
+
const cleanedData = Bun.stripANSI(data);
|
|
2409
|
+
this.emit("paste", new PasteEvent(cleanedData));
|
|
2410
|
+
} catch (error) {
|
|
2411
|
+
console.error(`[KeyHandler] Error processing paste:`, error);
|
|
2412
|
+
}
|
|
2338
2413
|
}
|
|
2339
2414
|
}
|
|
2340
2415
|
|
|
@@ -2347,18 +2422,28 @@ class InternalKeyHandler extends KeyHandler {
|
|
|
2347
2422
|
return this.emitWithPriority(event, ...args);
|
|
2348
2423
|
}
|
|
2349
2424
|
emitWithPriority(event, ...args) {
|
|
2350
|
-
|
|
2425
|
+
let hasGlobalListeners = false;
|
|
2426
|
+
try {
|
|
2427
|
+
hasGlobalListeners = super.emit(event, ...args);
|
|
2428
|
+
} catch (error) {
|
|
2429
|
+
console.error(`[KeyHandler] Error in global ${event} handler:`, error);
|
|
2430
|
+
}
|
|
2351
2431
|
const renderableSet = this.renderableHandlers.get(event);
|
|
2432
|
+
const renderableHandlers = renderableSet && renderableSet.size > 0 ? [...renderableSet] : [];
|
|
2352
2433
|
let hasRenderableListeners = false;
|
|
2353
2434
|
if (renderableSet && renderableSet.size > 0) {
|
|
2354
2435
|
hasRenderableListeners = true;
|
|
2355
|
-
if (event === "keypress" || event === "
|
|
2436
|
+
if (event === "keypress" || event === "keyrelease" || event === "paste") {
|
|
2356
2437
|
const keyEvent = args[0];
|
|
2357
2438
|
if (keyEvent.defaultPrevented)
|
|
2358
2439
|
return hasGlobalListeners || hasRenderableListeners;
|
|
2359
2440
|
}
|
|
2360
|
-
for (const handler of
|
|
2361
|
-
|
|
2441
|
+
for (const handler of renderableHandlers) {
|
|
2442
|
+
try {
|
|
2443
|
+
handler(...args);
|
|
2444
|
+
} catch (error) {
|
|
2445
|
+
console.error(`[KeyHandler] Error in renderable ${event} handler:`, error);
|
|
2446
|
+
}
|
|
2362
2447
|
}
|
|
2363
2448
|
}
|
|
2364
2449
|
return hasGlobalListeners || hasRenderableListeners;
|
|
@@ -8781,6 +8866,10 @@ function toHex(r, g, b, hex6) {
|
|
|
8781
8866
|
return `#${scaleComponent(r)}${scaleComponent(g)}${scaleComponent(b)}`;
|
|
8782
8867
|
return "#000000";
|
|
8783
8868
|
}
|
|
8869
|
+
function wrapForTmux(osc) {
|
|
8870
|
+
const escaped = osc.replace(/\x1b/g, "\x1B\x1B");
|
|
8871
|
+
return `\x1BPtmux;${escaped}\x1B\\`;
|
|
8872
|
+
}
|
|
8784
8873
|
|
|
8785
8874
|
class TerminalPalette {
|
|
8786
8875
|
stdin;
|
|
@@ -8788,10 +8877,16 @@ class TerminalPalette {
|
|
|
8788
8877
|
writeFn;
|
|
8789
8878
|
activeListeners = [];
|
|
8790
8879
|
activeTimers = [];
|
|
8791
|
-
|
|
8880
|
+
inTmux;
|
|
8881
|
+
constructor(stdin, stdout, writeFn, isTmux) {
|
|
8792
8882
|
this.stdin = stdin;
|
|
8793
8883
|
this.stdout = stdout;
|
|
8794
8884
|
this.writeFn = writeFn || ((data) => stdout.write(data));
|
|
8885
|
+
this.inTmux = isTmux ?? false;
|
|
8886
|
+
}
|
|
8887
|
+
writeOsc(osc) {
|
|
8888
|
+
const data = this.inTmux ? wrapForTmux(osc) : osc;
|
|
8889
|
+
return this.writeFn(data);
|
|
8795
8890
|
}
|
|
8796
8891
|
cleanup() {
|
|
8797
8892
|
for (const { event, handler } of this.activeListeners) {
|
|
@@ -8836,7 +8931,7 @@ class TerminalPalette {
|
|
|
8836
8931
|
this.activeTimers.push(timer);
|
|
8837
8932
|
inp.on("data", onData);
|
|
8838
8933
|
this.activeListeners.push({ event: "data", handler: onData });
|
|
8839
|
-
this.
|
|
8934
|
+
this.writeOsc("\x1B]4;0;?\x07");
|
|
8840
8935
|
});
|
|
8841
8936
|
}
|
|
8842
8937
|
async queryPalette(indices, timeoutMs = 1200) {
|
|
@@ -8903,7 +8998,7 @@ class TerminalPalette {
|
|
|
8903
8998
|
this.activeTimers.push(timer);
|
|
8904
8999
|
inp.on("data", onData);
|
|
8905
9000
|
this.activeListeners.push({ event: "data", handler: onData });
|
|
8906
|
-
this.
|
|
9001
|
+
this.writeOsc(indices.map((i) => `\x1B]4;${i};?\x07`).join(""));
|
|
8907
9002
|
});
|
|
8908
9003
|
}
|
|
8909
9004
|
async querySpecialColors(timeoutMs = 1200) {
|
|
@@ -8978,7 +9073,7 @@ class TerminalPalette {
|
|
|
8978
9073
|
this.activeTimers.push(timer);
|
|
8979
9074
|
inp.on("data", onData);
|
|
8980
9075
|
this.activeListeners.push({ event: "data", handler: onData });
|
|
8981
|
-
this.
|
|
9076
|
+
this.writeOsc([
|
|
8982
9077
|
"\x1B]10;?\x07",
|
|
8983
9078
|
"\x1B]11;?\x07",
|
|
8984
9079
|
"\x1B]12;?\x07",
|
|
@@ -9027,8 +9122,8 @@ class TerminalPalette {
|
|
|
9027
9122
|
};
|
|
9028
9123
|
}
|
|
9029
9124
|
}
|
|
9030
|
-
function createTerminalPalette(stdin, stdout, writeFn) {
|
|
9031
|
-
return new TerminalPalette(stdin, stdout, writeFn);
|
|
9125
|
+
function createTerminalPalette(stdin, stdout, writeFn, isTmux) {
|
|
9126
|
+
return new TerminalPalette(stdin, stdout, writeFn, isTmux);
|
|
9032
9127
|
}
|
|
9033
9128
|
// src/zig.ts
|
|
9034
9129
|
import { dlopen, toArrayBuffer as toArrayBuffer4, JSCallback, ptr as ptr3 } from "bun:ffi";
|
|
@@ -9932,6 +10027,21 @@ var EncodedCharStruct = defineStruct([
|
|
|
9932
10027
|
["width", "u8"],
|
|
9933
10028
|
["char", "u32"]
|
|
9934
10029
|
]);
|
|
10030
|
+
var LineInfoStruct = defineStruct([
|
|
10031
|
+
["starts", ["u32"]],
|
|
10032
|
+
["startsLen", "u32", { lengthOf: "starts" }],
|
|
10033
|
+
["widths", ["u32"]],
|
|
10034
|
+
["widthsLen", "u32", { lengthOf: "widths" }],
|
|
10035
|
+
["sources", ["u32"]],
|
|
10036
|
+
["sourcesLen", "u32", { lengthOf: "sources" }],
|
|
10037
|
+
["wraps", ["u32"]],
|
|
10038
|
+
["wrapsLen", "u32", { lengthOf: "wraps" }],
|
|
10039
|
+
["maxWidth", "u32"]
|
|
10040
|
+
]);
|
|
10041
|
+
var MeasureResultStruct = defineStruct([
|
|
10042
|
+
["lineCount", "u32"],
|
|
10043
|
+
["maxWidth", "u32"]
|
|
10044
|
+
]);
|
|
9935
10045
|
|
|
9936
10046
|
// src/zig.ts
|
|
9937
10047
|
var module = await import(`@opentui/core-${process.platform}-${process.arch}/index.ts`);
|
|
@@ -10381,17 +10491,21 @@ function getOpenTUILib(libPath) {
|
|
|
10381
10491
|
args: ["ptr", "u32", "u32"],
|
|
10382
10492
|
returns: "void"
|
|
10383
10493
|
},
|
|
10494
|
+
textBufferViewSetViewport: {
|
|
10495
|
+
args: ["ptr", "u32", "u32", "u32", "u32"],
|
|
10496
|
+
returns: "void"
|
|
10497
|
+
},
|
|
10384
10498
|
textBufferViewGetVirtualLineCount: {
|
|
10385
10499
|
args: ["ptr"],
|
|
10386
10500
|
returns: "u32"
|
|
10387
10501
|
},
|
|
10388
10502
|
textBufferViewGetLineInfoDirect: {
|
|
10389
|
-
args: ["ptr", "ptr"
|
|
10390
|
-
returns: "
|
|
10503
|
+
args: ["ptr", "ptr"],
|
|
10504
|
+
returns: "void"
|
|
10391
10505
|
},
|
|
10392
10506
|
textBufferViewGetLogicalLineInfoDirect: {
|
|
10393
|
-
args: ["ptr", "ptr"
|
|
10394
|
-
returns: "
|
|
10507
|
+
args: ["ptr", "ptr"],
|
|
10508
|
+
returns: "void"
|
|
10395
10509
|
},
|
|
10396
10510
|
textBufferViewGetSelectedText: {
|
|
10397
10511
|
args: ["ptr", "ptr", "usize"],
|
|
@@ -10409,6 +10523,10 @@ function getOpenTUILib(libPath) {
|
|
|
10409
10523
|
args: ["ptr", "ptr"],
|
|
10410
10524
|
returns: "void"
|
|
10411
10525
|
},
|
|
10526
|
+
textBufferViewMeasureForDimensions: {
|
|
10527
|
+
args: ["ptr", "u32", "u32", "ptr"],
|
|
10528
|
+
returns: "bool"
|
|
10529
|
+
},
|
|
10412
10530
|
bufferDrawTextBufferView: {
|
|
10413
10531
|
args: ["ptr", "ptr", "i32", "i32"],
|
|
10414
10532
|
returns: "void"
|
|
@@ -10454,12 +10572,12 @@ function getOpenTUILib(libPath) {
|
|
|
10454
10572
|
returns: "ptr"
|
|
10455
10573
|
},
|
|
10456
10574
|
editorViewGetLineInfoDirect: {
|
|
10457
|
-
args: ["ptr", "ptr"
|
|
10458
|
-
returns: "
|
|
10575
|
+
args: ["ptr", "ptr"],
|
|
10576
|
+
returns: "void"
|
|
10459
10577
|
},
|
|
10460
10578
|
editorViewGetLogicalLineInfoDirect: {
|
|
10461
|
-
args: ["ptr", "ptr"
|
|
10462
|
-
returns: "
|
|
10579
|
+
args: ["ptr", "ptr"],
|
|
10580
|
+
returns: "void"
|
|
10463
10581
|
},
|
|
10464
10582
|
createEditBuffer: {
|
|
10465
10583
|
args: ["u8"],
|
|
@@ -11362,42 +11480,41 @@ class FFIRenderLib {
|
|
|
11362
11480
|
textBufferViewSetViewportSize(view, width, height) {
|
|
11363
11481
|
this.opentui.symbols.textBufferViewSetViewportSize(view, width, height);
|
|
11364
11482
|
}
|
|
11483
|
+
textBufferViewSetViewport(view, x, y, width, height) {
|
|
11484
|
+
this.opentui.symbols.textBufferViewSetViewport(view, x, y, width, height);
|
|
11485
|
+
}
|
|
11365
11486
|
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));
|
|
11487
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11488
|
+
this.textBufferViewGetLineInfoDirect(view, ptr3(outBuffer));
|
|
11489
|
+
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11373
11490
|
return {
|
|
11374
|
-
maxLineWidth,
|
|
11375
|
-
lineStarts:
|
|
11376
|
-
lineWidths:
|
|
11491
|
+
maxLineWidth: struct.maxWidth,
|
|
11492
|
+
lineStarts: struct.starts,
|
|
11493
|
+
lineWidths: struct.widths,
|
|
11494
|
+
lineSources: struct.sources,
|
|
11495
|
+
lineWraps: struct.wraps
|
|
11377
11496
|
};
|
|
11378
11497
|
}
|
|
11379
11498
|
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));
|
|
11499
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11500
|
+
this.textBufferViewGetLogicalLineInfoDirect(view, ptr3(outBuffer));
|
|
11501
|
+
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11387
11502
|
return {
|
|
11388
|
-
maxLineWidth,
|
|
11389
|
-
lineStarts:
|
|
11390
|
-
lineWidths:
|
|
11503
|
+
maxLineWidth: struct.maxWidth,
|
|
11504
|
+
lineStarts: struct.starts,
|
|
11505
|
+
lineWidths: struct.widths,
|
|
11506
|
+
lineSources: struct.sources,
|
|
11507
|
+
lineWraps: struct.wraps
|
|
11391
11508
|
};
|
|
11392
11509
|
}
|
|
11393
11510
|
textBufferViewGetLineCount(view) {
|
|
11394
11511
|
return this.opentui.symbols.textBufferViewGetVirtualLineCount(view);
|
|
11395
11512
|
}
|
|
11396
|
-
textBufferViewGetLineInfoDirect(view,
|
|
11397
|
-
|
|
11513
|
+
textBufferViewGetLineInfoDirect(view, outPtr) {
|
|
11514
|
+
this.opentui.symbols.textBufferViewGetLineInfoDirect(view, outPtr);
|
|
11398
11515
|
}
|
|
11399
|
-
textBufferViewGetLogicalLineInfoDirect(view,
|
|
11400
|
-
|
|
11516
|
+
textBufferViewGetLogicalLineInfoDirect(view, outPtr) {
|
|
11517
|
+
this.opentui.symbols.textBufferViewGetLogicalLineInfoDirect(view, outPtr);
|
|
11401
11518
|
}
|
|
11402
11519
|
textBufferViewGetSelectedText(view, outPtr, maxLen) {
|
|
11403
11520
|
const result = this.opentui.symbols.textBufferViewGetSelectedText(view, outPtr, maxLen);
|
|
@@ -11429,6 +11546,16 @@ class FFIRenderLib {
|
|
|
11429
11546
|
textBufferViewSetTabIndicatorColor(view, color) {
|
|
11430
11547
|
this.opentui.symbols.textBufferViewSetTabIndicatorColor(view, color.buffer);
|
|
11431
11548
|
}
|
|
11549
|
+
textBufferViewMeasureForDimensions(view, width, height) {
|
|
11550
|
+
const resultBuffer = new ArrayBuffer(MeasureResultStruct.size);
|
|
11551
|
+
const resultPtr = ptr3(new Uint8Array(resultBuffer));
|
|
11552
|
+
const success = this.opentui.symbols.textBufferViewMeasureForDimensions(view, width, height, resultPtr);
|
|
11553
|
+
if (!success) {
|
|
11554
|
+
return null;
|
|
11555
|
+
}
|
|
11556
|
+
const result = MeasureResultStruct.unpack(resultBuffer);
|
|
11557
|
+
return result;
|
|
11558
|
+
}
|
|
11432
11559
|
textBufferAddHighlightByCharRange(buffer, highlight) {
|
|
11433
11560
|
const packedHighlight = HighlightStruct.pack(highlight);
|
|
11434
11561
|
this.opentui.symbols.textBufferAddHighlightByCharRange(buffer, ptr3(packedHighlight));
|
|
@@ -11521,31 +11648,27 @@ class FFIRenderLib {
|
|
|
11521
11648
|
return result;
|
|
11522
11649
|
}
|
|
11523
11650
|
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));
|
|
11651
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11652
|
+
this.opentui.symbols.editorViewGetLineInfoDirect(view, ptr3(outBuffer));
|
|
11653
|
+
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11531
11654
|
return {
|
|
11532
|
-
maxLineWidth,
|
|
11533
|
-
lineStarts:
|
|
11534
|
-
lineWidths:
|
|
11655
|
+
maxLineWidth: struct.maxWidth,
|
|
11656
|
+
lineStarts: struct.starts,
|
|
11657
|
+
lineWidths: struct.widths,
|
|
11658
|
+
lineSources: struct.sources,
|
|
11659
|
+
lineWraps: struct.wraps
|
|
11535
11660
|
};
|
|
11536
11661
|
}
|
|
11537
11662
|
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));
|
|
11663
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11664
|
+
this.opentui.symbols.editorViewGetLogicalLineInfoDirect(view, ptr3(outBuffer));
|
|
11665
|
+
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11545
11666
|
return {
|
|
11546
|
-
maxLineWidth,
|
|
11547
|
-
lineStarts:
|
|
11548
|
-
lineWidths:
|
|
11667
|
+
maxLineWidth: struct.maxWidth,
|
|
11668
|
+
lineStarts: struct.starts,
|
|
11669
|
+
lineWidths: struct.widths,
|
|
11670
|
+
lineSources: struct.sources,
|
|
11671
|
+
lineWraps: struct.wraps
|
|
11549
11672
|
};
|
|
11550
11673
|
}
|
|
11551
11674
|
createEditBuffer(widthMethod) {
|
|
@@ -12016,6 +12139,10 @@ class TextBuffer {
|
|
|
12016
12139
|
this.guard();
|
|
12017
12140
|
this.lib.textBufferResetDefaults(this.bufferPtr);
|
|
12018
12141
|
}
|
|
12142
|
+
getLineCount() {
|
|
12143
|
+
this.guard();
|
|
12144
|
+
return this.lib.textBufferGetLineCount(this.bufferPtr);
|
|
12145
|
+
}
|
|
12019
12146
|
get length() {
|
|
12020
12147
|
this.guard();
|
|
12021
12148
|
return this._length;
|
|
@@ -14878,7 +15005,7 @@ Captured output:
|
|
|
14878
15005
|
this.mouseParser.reset();
|
|
14879
15006
|
this.lib.disableMouse(this.rendererPtr);
|
|
14880
15007
|
}
|
|
14881
|
-
enableKittyKeyboard(flags =
|
|
15008
|
+
enableKittyKeyboard(flags = 3) {
|
|
14882
15009
|
this.lib.enableKittyKeyboard(this.rendererPtr, flags);
|
|
14883
15010
|
}
|
|
14884
15011
|
disableKittyKeyboard() {
|
|
@@ -15645,7 +15772,8 @@ Captured output:
|
|
|
15645
15772
|
return this._paletteDetectionPromise;
|
|
15646
15773
|
}
|
|
15647
15774
|
if (!this._paletteDetector) {
|
|
15648
|
-
|
|
15775
|
+
const isTmux = this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux");
|
|
15776
|
+
this._paletteDetector = createTerminalPalette(this.stdin, this.stdout, this.writeOut.bind(this), isTmux);
|
|
15649
15777
|
}
|
|
15650
15778
|
this._paletteDetectionPromise = this._paletteDetector.detect(options).then((result) => {
|
|
15651
15779
|
this._cachedPalette = result;
|
|
@@ -15656,7 +15784,7 @@ Captured output:
|
|
|
15656
15784
|
}
|
|
15657
15785
|
}
|
|
15658
15786
|
|
|
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 };
|
|
15787
|
+
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
15788
|
|
|
15661
|
-
//# debugId=
|
|
15662
|
-
//# sourceMappingURL=index-
|
|
15789
|
+
//# debugId=1108F3F0A4484C0264756E2164756E21
|
|
15790
|
+
//# sourceMappingURL=index-vhxgbbed.js.map
|