@opentui/core 0.1.32 → 0.1.34
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/edit-buffer.d.ts +2 -0
- package/{index-3f9h747j.js → index-x37wckj8.js} +100 -17
- package/{index-3f9h747j.js.map → index-x37wckj8.js.map} +6 -6
- package/index.js +47 -4
- package/index.js.map +5 -5
- package/package.json +7 -7
- package/renderables/Code.d.ts +5 -0
- package/renderables/EditBufferRenderable.d.ts +2 -0
- package/renderer.d.ts +2 -0
- package/testing/mock-tree-sitter-client.d.ts +20 -0
- package/testing.d.ts +1 -0
- package/testing.js +35 -2
- package/testing.js.map +4 -3
- package/text-buffer.d.ts +1 -0
- package/zig.d.ts +6 -0
package/3d.js
CHANGED
package/edit-buffer.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ export declare class EditBuffer extends EventEmitter {
|
|
|
58
58
|
} | null;
|
|
59
59
|
positionToOffset(row: number, col: number): number;
|
|
60
60
|
getLineStartOffset(row: number): number;
|
|
61
|
+
getTextRange(startOffset: number, endOffset: number): string;
|
|
62
|
+
getTextRangeByCoords(startRow: number, startCol: number, endRow: number, endCol: number): string;
|
|
61
63
|
debugLogRope(): void;
|
|
62
64
|
undo(): string | null;
|
|
63
65
|
redo(): string | null;
|
|
@@ -8408,6 +8408,14 @@ function getOpenTUILib(libPath) {
|
|
|
8408
8408
|
args: ["ptr"],
|
|
8409
8409
|
returns: "void"
|
|
8410
8410
|
},
|
|
8411
|
+
setUseKittyKeyboard: {
|
|
8412
|
+
args: ["ptr", "bool"],
|
|
8413
|
+
returns: "void"
|
|
8414
|
+
},
|
|
8415
|
+
getUseKittyKeyboard: {
|
|
8416
|
+
args: ["ptr"],
|
|
8417
|
+
returns: "bool"
|
|
8418
|
+
},
|
|
8411
8419
|
setupTerminal: {
|
|
8412
8420
|
args: ["ptr", "bool"],
|
|
8413
8421
|
returns: "void"
|
|
@@ -8528,6 +8536,14 @@ function getOpenTUILib(libPath) {
|
|
|
8528
8536
|
args: ["ptr"],
|
|
8529
8537
|
returns: "u32"
|
|
8530
8538
|
},
|
|
8539
|
+
textBufferGetTextRange: {
|
|
8540
|
+
args: ["ptr", "u32", "u32", "ptr", "usize"],
|
|
8541
|
+
returns: "usize"
|
|
8542
|
+
},
|
|
8543
|
+
textBufferGetTextRangeByCoords: {
|
|
8544
|
+
args: ["ptr", "u32", "u32", "u32", "u32", "ptr", "usize"],
|
|
8545
|
+
returns: "usize"
|
|
8546
|
+
},
|
|
8531
8547
|
createTextBufferView: {
|
|
8532
8548
|
args: ["ptr"],
|
|
8533
8549
|
returns: "ptr"
|
|
@@ -8792,6 +8808,14 @@ function getOpenTUILib(libPath) {
|
|
|
8792
8808
|
args: ["ptr", "u32"],
|
|
8793
8809
|
returns: "u32"
|
|
8794
8810
|
},
|
|
8811
|
+
editBufferGetTextRange: {
|
|
8812
|
+
args: ["ptr", "u32", "u32", "ptr", "usize"],
|
|
8813
|
+
returns: "usize"
|
|
8814
|
+
},
|
|
8815
|
+
editBufferGetTextRangeByCoords: {
|
|
8816
|
+
args: ["ptr", "u32", "u32", "u32", "u32", "ptr", "usize"],
|
|
8817
|
+
returns: "usize"
|
|
8818
|
+
},
|
|
8795
8819
|
editorViewSetSelection: {
|
|
8796
8820
|
args: ["ptr", "u32", "u32", "ptr", "ptr"],
|
|
8797
8821
|
returns: "void"
|
|
@@ -9332,6 +9356,12 @@ class FFIRenderLib {
|
|
|
9332
9356
|
disableKittyKeyboard(renderer) {
|
|
9333
9357
|
this.opentui.symbols.disableKittyKeyboard(renderer);
|
|
9334
9358
|
}
|
|
9359
|
+
setUseKittyKeyboard(renderer, use) {
|
|
9360
|
+
this.opentui.symbols.setUseKittyKeyboard(renderer, use);
|
|
9361
|
+
}
|
|
9362
|
+
getUseKittyKeyboard(renderer) {
|
|
9363
|
+
return this.opentui.symbols.getUseKittyKeyboard(renderer);
|
|
9364
|
+
}
|
|
9335
9365
|
setupTerminal(renderer, useAlternateScreen) {
|
|
9336
9366
|
this.opentui.symbols.setupTerminal(renderer, useAlternateScreen);
|
|
9337
9367
|
}
|
|
@@ -9426,6 +9456,24 @@ class FFIRenderLib {
|
|
|
9426
9456
|
}
|
|
9427
9457
|
return outBuffer.slice(0, actualLen);
|
|
9428
9458
|
}
|
|
9459
|
+
textBufferGetTextRange(buffer, startOffset, endOffset, maxLength) {
|
|
9460
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
9461
|
+
const actualLen = this.opentui.symbols.textBufferGetTextRange(buffer, startOffset, endOffset, ptr3(outBuffer), maxLength);
|
|
9462
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
9463
|
+
if (len === 0) {
|
|
9464
|
+
return null;
|
|
9465
|
+
}
|
|
9466
|
+
return outBuffer.slice(0, len);
|
|
9467
|
+
}
|
|
9468
|
+
textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, maxLength) {
|
|
9469
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
9470
|
+
const actualLen = this.opentui.symbols.textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, ptr3(outBuffer), maxLength);
|
|
9471
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
9472
|
+
if (len === 0) {
|
|
9473
|
+
return null;
|
|
9474
|
+
}
|
|
9475
|
+
return outBuffer.slice(0, len);
|
|
9476
|
+
}
|
|
9429
9477
|
createTextBufferView(textBuffer) {
|
|
9430
9478
|
const viewPtr = this.opentui.symbols.createTextBufferView(textBuffer);
|
|
9431
9479
|
if (!viewPtr) {
|
|
@@ -9806,6 +9854,22 @@ class FFIRenderLib {
|
|
|
9806
9854
|
editBufferGetLineStartOffset(buffer, row) {
|
|
9807
9855
|
return this.opentui.symbols.editBufferGetLineStartOffset(buffer, row);
|
|
9808
9856
|
}
|
|
9857
|
+
editBufferGetTextRange(buffer, startOffset, endOffset, maxLength) {
|
|
9858
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
9859
|
+
const actualLen = this.opentui.symbols.editBufferGetTextRange(buffer, startOffset, endOffset, ptr3(outBuffer), maxLength);
|
|
9860
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
9861
|
+
if (len === 0)
|
|
9862
|
+
return null;
|
|
9863
|
+
return outBuffer.slice(0, len);
|
|
9864
|
+
}
|
|
9865
|
+
editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, maxLength) {
|
|
9866
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
9867
|
+
const actualLen = this.opentui.symbols.editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, ptr3(outBuffer), maxLength);
|
|
9868
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
9869
|
+
if (len === 0)
|
|
9870
|
+
return null;
|
|
9871
|
+
return outBuffer.slice(0, len);
|
|
9872
|
+
}
|
|
9809
9873
|
editorViewSetSelection(view, start, end, bgColor, fgColor) {
|
|
9810
9874
|
const bg2 = bgColor ? bgColor.buffer : null;
|
|
9811
9875
|
const fg2 = fgColor ? fgColor.buffer : null;
|
|
@@ -10091,6 +10155,17 @@ class TextBuffer {
|
|
|
10091
10155
|
return "";
|
|
10092
10156
|
return this.lib.decoder.decode(plainBytes);
|
|
10093
10157
|
}
|
|
10158
|
+
getTextRange(startOffset, endOffset) {
|
|
10159
|
+
this.guard();
|
|
10160
|
+
if (startOffset >= endOffset)
|
|
10161
|
+
return "";
|
|
10162
|
+
if (this._byteSize === 0)
|
|
10163
|
+
return "";
|
|
10164
|
+
const rangeBytes = this.lib.textBufferGetTextRange(this.bufferPtr, startOffset, endOffset, this._byteSize);
|
|
10165
|
+
if (!rangeBytes)
|
|
10166
|
+
return "";
|
|
10167
|
+
return this.lib.decoder.decode(rangeBytes);
|
|
10168
|
+
}
|
|
10094
10169
|
addHighlightByCharRange(highlight) {
|
|
10095
10170
|
this.guard();
|
|
10096
10171
|
this.lib.textBufferAddHighlightByCharRange(this.bufferPtr, highlight);
|
|
@@ -11877,34 +11952,34 @@ class TerminalConsole extends EventEmitter8 {
|
|
|
11877
11952
|
}
|
|
11878
11953
|
this.markNeedsRerender();
|
|
11879
11954
|
}
|
|
11880
|
-
_updateConsoleDimensions() {
|
|
11881
|
-
const
|
|
11882
|
-
const
|
|
11955
|
+
_updateConsoleDimensions(termWidth, termHeight) {
|
|
11956
|
+
const width = termWidth ?? this.renderer.terminalWidth;
|
|
11957
|
+
const height = termHeight ?? this.renderer.terminalHeight;
|
|
11883
11958
|
const sizePercent = this.options.sizePercent / 100;
|
|
11884
11959
|
switch (this.options.position) {
|
|
11885
11960
|
case "top" /* TOP */:
|
|
11886
11961
|
this.consoleX = 0;
|
|
11887
11962
|
this.consoleY = 0;
|
|
11888
|
-
this.consoleWidth =
|
|
11889
|
-
this.consoleHeight = Math.max(1, Math.floor(
|
|
11963
|
+
this.consoleWidth = width;
|
|
11964
|
+
this.consoleHeight = Math.max(1, Math.floor(height * sizePercent));
|
|
11890
11965
|
break;
|
|
11891
11966
|
case "bottom" /* BOTTOM */:
|
|
11892
|
-
this.consoleHeight = Math.max(1, Math.floor(
|
|
11893
|
-
this.consoleWidth =
|
|
11967
|
+
this.consoleHeight = Math.max(1, Math.floor(height * sizePercent));
|
|
11968
|
+
this.consoleWidth = width;
|
|
11894
11969
|
this.consoleX = 0;
|
|
11895
|
-
this.consoleY =
|
|
11970
|
+
this.consoleY = height - this.consoleHeight;
|
|
11896
11971
|
break;
|
|
11897
11972
|
case "left" /* LEFT */:
|
|
11898
|
-
this.consoleWidth = Math.max(1, Math.floor(
|
|
11899
|
-
this.consoleHeight =
|
|
11973
|
+
this.consoleWidth = Math.max(1, Math.floor(width * sizePercent));
|
|
11974
|
+
this.consoleHeight = height;
|
|
11900
11975
|
this.consoleX = 0;
|
|
11901
11976
|
this.consoleY = 0;
|
|
11902
11977
|
break;
|
|
11903
11978
|
case "right" /* RIGHT */:
|
|
11904
|
-
this.consoleWidth = Math.max(1, Math.floor(
|
|
11905
|
-
this.consoleHeight =
|
|
11979
|
+
this.consoleWidth = Math.max(1, Math.floor(width * sizePercent));
|
|
11980
|
+
this.consoleHeight = height;
|
|
11906
11981
|
this.consoleY = 0;
|
|
11907
|
-
this.consoleX =
|
|
11982
|
+
this.consoleX = width - this.consoleWidth;
|
|
11908
11983
|
break;
|
|
11909
11984
|
}
|
|
11910
11985
|
this.currentLineIndex = Math.max(0, Math.min(this.currentLineIndex, this.consoleHeight - 1));
|
|
@@ -12026,7 +12101,7 @@ class TerminalConsole extends EventEmitter8 {
|
|
|
12026
12101
|
}).join(" ");
|
|
12027
12102
|
}
|
|
12028
12103
|
resize(width, height) {
|
|
12029
|
-
this._updateConsoleDimensions();
|
|
12104
|
+
this._updateConsoleDimensions(width, height);
|
|
12030
12105
|
if (this.frameBuffer) {
|
|
12031
12106
|
this.frameBuffer.resize(this.consoleWidth, this.consoleHeight);
|
|
12032
12107
|
const displayLineCount = this._displayLines.length;
|
|
@@ -12456,6 +12531,8 @@ async function createCliRenderer(config = {}) {
|
|
|
12456
12531
|
config.useThread = false;
|
|
12457
12532
|
}
|
|
12458
12533
|
ziglib.setUseThread(rendererPtr, config.useThread);
|
|
12534
|
+
const useKittyKeyboard = config.useKittyKeyboard ?? true;
|
|
12535
|
+
ziglib.setUseKittyKeyboard(rendererPtr, useKittyKeyboard);
|
|
12459
12536
|
const renderer = new CliRenderer(ziglib, rendererPtr, stdin, stdout, width, height, config);
|
|
12460
12537
|
await renderer.setupTerminal();
|
|
12461
12538
|
return renderer;
|
|
@@ -12652,7 +12729,7 @@ Captured output:
|
|
|
12652
12729
|
process.on("exit", this.exitHandler);
|
|
12653
12730
|
this._console = new TerminalConsole(this, config.consoleOptions);
|
|
12654
12731
|
this.useConsole = config.useConsole ?? true;
|
|
12655
|
-
this._keyHandler = new InternalKeyHandler(this.stdin, config.useKittyKeyboard ??
|
|
12732
|
+
this._keyHandler = new InternalKeyHandler(this.stdin, config.useKittyKeyboard ?? true);
|
|
12656
12733
|
this._keyHandler.on("keypress", (event) => {
|
|
12657
12734
|
if (this.exitOnCtrlC && event.name === "c" && event.ctrl) {
|
|
12658
12735
|
process.nextTick(() => {
|
|
@@ -12788,6 +12865,12 @@ Captured output:
|
|
|
12788
12865
|
get capabilities() {
|
|
12789
12866
|
return this._capabilities;
|
|
12790
12867
|
}
|
|
12868
|
+
get useKittyKeyboard() {
|
|
12869
|
+
return this.lib.getUseKittyKeyboard(this.rendererPtr);
|
|
12870
|
+
}
|
|
12871
|
+
set useKittyKeyboard(use) {
|
|
12872
|
+
this.lib.setUseKittyKeyboard(this.rendererPtr, use);
|
|
12873
|
+
}
|
|
12791
12874
|
set experimental_splitHeight(splitHeight) {
|
|
12792
12875
|
if (splitHeight < 0)
|
|
12793
12876
|
splitHeight = 0;
|
|
@@ -13561,5 +13644,5 @@ Captured output:
|
|
|
13561
13644
|
|
|
13562
13645
|
export { __toESM, __commonJS, __export, __require, Edge, Gutter, exports_src, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, ANSI, StdinBuffer, 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, 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, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
|
|
13563
13646
|
|
|
13564
|
-
//# debugId=
|
|
13565
|
-
//# sourceMappingURL=index-
|
|
13647
|
+
//# debugId=FED981AE33D192C664756E2164756E21
|
|
13648
|
+
//# sourceMappingURL=index-x37wckj8.js.map
|