@opentui/core 0.1.32 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/3d.js +1 -1
- package/edit-buffer.d.ts +2 -0
- package/{index-3f9h747j.js → index-xqg0a6ka.js} +77 -16
- package/{index-3f9h747j.js.map → index-xqg0a6ka.js.map} +5 -5
- package/index.js +26 -2
- package/index.js.map +4 -4
- package/package.json +7 -7
- package/renderables/EditBufferRenderable.d.ts +2 -0
- package/testing.js +1 -1
- package/text-buffer.d.ts +1 -0
- package/zig.d.ts +4 -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;
|
|
@@ -8528,6 +8528,14 @@ function getOpenTUILib(libPath) {
|
|
|
8528
8528
|
args: ["ptr"],
|
|
8529
8529
|
returns: "u32"
|
|
8530
8530
|
},
|
|
8531
|
+
textBufferGetTextRange: {
|
|
8532
|
+
args: ["ptr", "u32", "u32", "ptr", "usize"],
|
|
8533
|
+
returns: "usize"
|
|
8534
|
+
},
|
|
8535
|
+
textBufferGetTextRangeByCoords: {
|
|
8536
|
+
args: ["ptr", "u32", "u32", "u32", "u32", "ptr", "usize"],
|
|
8537
|
+
returns: "usize"
|
|
8538
|
+
},
|
|
8531
8539
|
createTextBufferView: {
|
|
8532
8540
|
args: ["ptr"],
|
|
8533
8541
|
returns: "ptr"
|
|
@@ -8792,6 +8800,14 @@ function getOpenTUILib(libPath) {
|
|
|
8792
8800
|
args: ["ptr", "u32"],
|
|
8793
8801
|
returns: "u32"
|
|
8794
8802
|
},
|
|
8803
|
+
editBufferGetTextRange: {
|
|
8804
|
+
args: ["ptr", "u32", "u32", "ptr", "usize"],
|
|
8805
|
+
returns: "usize"
|
|
8806
|
+
},
|
|
8807
|
+
editBufferGetTextRangeByCoords: {
|
|
8808
|
+
args: ["ptr", "u32", "u32", "u32", "u32", "ptr", "usize"],
|
|
8809
|
+
returns: "usize"
|
|
8810
|
+
},
|
|
8795
8811
|
editorViewSetSelection: {
|
|
8796
8812
|
args: ["ptr", "u32", "u32", "ptr", "ptr"],
|
|
8797
8813
|
returns: "void"
|
|
@@ -9426,6 +9442,24 @@ class FFIRenderLib {
|
|
|
9426
9442
|
}
|
|
9427
9443
|
return outBuffer.slice(0, actualLen);
|
|
9428
9444
|
}
|
|
9445
|
+
textBufferGetTextRange(buffer, startOffset, endOffset, maxLength) {
|
|
9446
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
9447
|
+
const actualLen = this.opentui.symbols.textBufferGetTextRange(buffer, startOffset, endOffset, ptr3(outBuffer), maxLength);
|
|
9448
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
9449
|
+
if (len === 0) {
|
|
9450
|
+
return null;
|
|
9451
|
+
}
|
|
9452
|
+
return outBuffer.slice(0, len);
|
|
9453
|
+
}
|
|
9454
|
+
textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, maxLength) {
|
|
9455
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
9456
|
+
const actualLen = this.opentui.symbols.textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, ptr3(outBuffer), maxLength);
|
|
9457
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
9458
|
+
if (len === 0) {
|
|
9459
|
+
return null;
|
|
9460
|
+
}
|
|
9461
|
+
return outBuffer.slice(0, len);
|
|
9462
|
+
}
|
|
9429
9463
|
createTextBufferView(textBuffer) {
|
|
9430
9464
|
const viewPtr = this.opentui.symbols.createTextBufferView(textBuffer);
|
|
9431
9465
|
if (!viewPtr) {
|
|
@@ -9806,6 +9840,22 @@ class FFIRenderLib {
|
|
|
9806
9840
|
editBufferGetLineStartOffset(buffer, row) {
|
|
9807
9841
|
return this.opentui.symbols.editBufferGetLineStartOffset(buffer, row);
|
|
9808
9842
|
}
|
|
9843
|
+
editBufferGetTextRange(buffer, startOffset, endOffset, maxLength) {
|
|
9844
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
9845
|
+
const actualLen = this.opentui.symbols.editBufferGetTextRange(buffer, startOffset, endOffset, ptr3(outBuffer), maxLength);
|
|
9846
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
9847
|
+
if (len === 0)
|
|
9848
|
+
return null;
|
|
9849
|
+
return outBuffer.slice(0, len);
|
|
9850
|
+
}
|
|
9851
|
+
editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, maxLength) {
|
|
9852
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
9853
|
+
const actualLen = this.opentui.symbols.editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, ptr3(outBuffer), maxLength);
|
|
9854
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
9855
|
+
if (len === 0)
|
|
9856
|
+
return null;
|
|
9857
|
+
return outBuffer.slice(0, len);
|
|
9858
|
+
}
|
|
9809
9859
|
editorViewSetSelection(view, start, end, bgColor, fgColor) {
|
|
9810
9860
|
const bg2 = bgColor ? bgColor.buffer : null;
|
|
9811
9861
|
const fg2 = fgColor ? fgColor.buffer : null;
|
|
@@ -10091,6 +10141,17 @@ class TextBuffer {
|
|
|
10091
10141
|
return "";
|
|
10092
10142
|
return this.lib.decoder.decode(plainBytes);
|
|
10093
10143
|
}
|
|
10144
|
+
getTextRange(startOffset, endOffset) {
|
|
10145
|
+
this.guard();
|
|
10146
|
+
if (startOffset >= endOffset)
|
|
10147
|
+
return "";
|
|
10148
|
+
if (this._byteSize === 0)
|
|
10149
|
+
return "";
|
|
10150
|
+
const rangeBytes = this.lib.textBufferGetTextRange(this.bufferPtr, startOffset, endOffset, this._byteSize);
|
|
10151
|
+
if (!rangeBytes)
|
|
10152
|
+
return "";
|
|
10153
|
+
return this.lib.decoder.decode(rangeBytes);
|
|
10154
|
+
}
|
|
10094
10155
|
addHighlightByCharRange(highlight) {
|
|
10095
10156
|
this.guard();
|
|
10096
10157
|
this.lib.textBufferAddHighlightByCharRange(this.bufferPtr, highlight);
|
|
@@ -11877,34 +11938,34 @@ class TerminalConsole extends EventEmitter8 {
|
|
|
11877
11938
|
}
|
|
11878
11939
|
this.markNeedsRerender();
|
|
11879
11940
|
}
|
|
11880
|
-
_updateConsoleDimensions() {
|
|
11881
|
-
const
|
|
11882
|
-
const
|
|
11941
|
+
_updateConsoleDimensions(termWidth, termHeight) {
|
|
11942
|
+
const width = termWidth ?? this.renderer.terminalWidth;
|
|
11943
|
+
const height = termHeight ?? this.renderer.terminalHeight;
|
|
11883
11944
|
const sizePercent = this.options.sizePercent / 100;
|
|
11884
11945
|
switch (this.options.position) {
|
|
11885
11946
|
case "top" /* TOP */:
|
|
11886
11947
|
this.consoleX = 0;
|
|
11887
11948
|
this.consoleY = 0;
|
|
11888
|
-
this.consoleWidth =
|
|
11889
|
-
this.consoleHeight = Math.max(1, Math.floor(
|
|
11949
|
+
this.consoleWidth = width;
|
|
11950
|
+
this.consoleHeight = Math.max(1, Math.floor(height * sizePercent));
|
|
11890
11951
|
break;
|
|
11891
11952
|
case "bottom" /* BOTTOM */:
|
|
11892
|
-
this.consoleHeight = Math.max(1, Math.floor(
|
|
11893
|
-
this.consoleWidth =
|
|
11953
|
+
this.consoleHeight = Math.max(1, Math.floor(height * sizePercent));
|
|
11954
|
+
this.consoleWidth = width;
|
|
11894
11955
|
this.consoleX = 0;
|
|
11895
|
-
this.consoleY =
|
|
11956
|
+
this.consoleY = height - this.consoleHeight;
|
|
11896
11957
|
break;
|
|
11897
11958
|
case "left" /* LEFT */:
|
|
11898
|
-
this.consoleWidth = Math.max(1, Math.floor(
|
|
11899
|
-
this.consoleHeight =
|
|
11959
|
+
this.consoleWidth = Math.max(1, Math.floor(width * sizePercent));
|
|
11960
|
+
this.consoleHeight = height;
|
|
11900
11961
|
this.consoleX = 0;
|
|
11901
11962
|
this.consoleY = 0;
|
|
11902
11963
|
break;
|
|
11903
11964
|
case "right" /* RIGHT */:
|
|
11904
|
-
this.consoleWidth = Math.max(1, Math.floor(
|
|
11905
|
-
this.consoleHeight =
|
|
11965
|
+
this.consoleWidth = Math.max(1, Math.floor(width * sizePercent));
|
|
11966
|
+
this.consoleHeight = height;
|
|
11906
11967
|
this.consoleY = 0;
|
|
11907
|
-
this.consoleX =
|
|
11968
|
+
this.consoleX = width - this.consoleWidth;
|
|
11908
11969
|
break;
|
|
11909
11970
|
}
|
|
11910
11971
|
this.currentLineIndex = Math.max(0, Math.min(this.currentLineIndex, this.consoleHeight - 1));
|
|
@@ -12026,7 +12087,7 @@ class TerminalConsole extends EventEmitter8 {
|
|
|
12026
12087
|
}).join(" ");
|
|
12027
12088
|
}
|
|
12028
12089
|
resize(width, height) {
|
|
12029
|
-
this._updateConsoleDimensions();
|
|
12090
|
+
this._updateConsoleDimensions(width, height);
|
|
12030
12091
|
if (this.frameBuffer) {
|
|
12031
12092
|
this.frameBuffer.resize(this.consoleWidth, this.consoleHeight);
|
|
12032
12093
|
const displayLineCount = this._displayLines.length;
|
|
@@ -13561,5 +13622,5 @@ Captured output:
|
|
|
13561
13622
|
|
|
13562
13623
|
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
13624
|
|
|
13564
|
-
//# debugId=
|
|
13565
|
-
//# sourceMappingURL=index-
|
|
13625
|
+
//# debugId=528F00EFA5B11C6264756E2164756E21
|
|
13626
|
+
//# sourceMappingURL=index-xqg0a6ka.js.map
|