@opentui/core 0.1.61 → 0.1.62
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/editor-view.d.ts +4 -1
- package/{index-rysm4rsr.js → index-mrwvcpzb.js} +82 -30
- package/{index-rysm4rsr.js.map → index-mrwvcpzb.js.map} +7 -7
- package/index.js +126 -52
- package/index.js.map +6 -6
- package/lib/selection.d.ts +4 -4
- package/package.json +7 -7
- package/renderables/EditBufferRenderable.d.ts +10 -1
- package/testing/test-recorder.d.ts +16 -1
- package/testing.js +21 -5
- package/testing.js.map +3 -3
- package/text-buffer-view.d.ts +2 -0
- package/zig.d.ts +6 -1
package/3d.js
CHANGED
package/editor-view.d.ts
CHANGED
|
@@ -21,19 +21,22 @@ export declare class EditorView {
|
|
|
21
21
|
private guard;
|
|
22
22
|
get ptr(): Pointer;
|
|
23
23
|
setViewportSize(width: number, height: number): void;
|
|
24
|
+
setViewport(x: number, y: number, width: number, height: number, moveCursor?: boolean): void;
|
|
24
25
|
getViewport(): Viewport;
|
|
25
26
|
setScrollMargin(margin: number): void;
|
|
26
27
|
setWrapMode(mode: "none" | "char" | "word"): void;
|
|
27
28
|
getVirtualLineCount(): number;
|
|
28
29
|
getTotalVirtualLineCount(): number;
|
|
29
30
|
setSelection(start: number, end: number, bgColor?: RGBA, fgColor?: RGBA): void;
|
|
31
|
+
updateSelection(end: number, bgColor?: RGBA, fgColor?: RGBA): void;
|
|
30
32
|
resetSelection(): void;
|
|
31
33
|
getSelection(): {
|
|
32
34
|
start: number;
|
|
33
35
|
end: number;
|
|
34
36
|
} | null;
|
|
35
37
|
hasSelection(): boolean;
|
|
36
|
-
setLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA): boolean;
|
|
38
|
+
setLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA, updateCursor?: boolean): boolean;
|
|
39
|
+
updateLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA, updateCursor?: boolean): boolean;
|
|
37
40
|
resetLocalSelection(): void;
|
|
38
41
|
getSelectedText(): string;
|
|
39
42
|
getCursor(): {
|
|
@@ -6480,37 +6480,30 @@ class SelectionAnchor {
|
|
|
6480
6480
|
|
|
6481
6481
|
class Selection {
|
|
6482
6482
|
_anchor;
|
|
6483
|
-
|
|
6484
|
-
_normalizedAnchor;
|
|
6485
|
-
_normalizedFocus;
|
|
6483
|
+
_focus;
|
|
6486
6484
|
_selectedRenderables = [];
|
|
6487
6485
|
_touchedRenderables = [];
|
|
6488
6486
|
_isActive = true;
|
|
6489
6487
|
_isSelecting = true;
|
|
6488
|
+
_isStart = false;
|
|
6490
6489
|
constructor(anchorRenderable, anchor, focus) {
|
|
6491
6490
|
this._anchor = new SelectionAnchor(anchorRenderable, anchor.x, anchor.y);
|
|
6492
|
-
this.
|
|
6493
|
-
|
|
6491
|
+
this._focus = { ...focus };
|
|
6492
|
+
}
|
|
6493
|
+
get isStart() {
|
|
6494
|
+
return this._isStart;
|
|
6495
|
+
}
|
|
6496
|
+
set isStart(value) {
|
|
6497
|
+
this._isStart = value;
|
|
6494
6498
|
}
|
|
6495
6499
|
get anchor() {
|
|
6496
|
-
return {
|
|
6500
|
+
return { x: this._anchor.x, y: this._anchor.y };
|
|
6497
6501
|
}
|
|
6498
6502
|
get focus() {
|
|
6499
|
-
return { ...this.
|
|
6503
|
+
return { ...this._focus };
|
|
6500
6504
|
}
|
|
6501
6505
|
set focus(value) {
|
|
6502
|
-
this.
|
|
6503
|
-
this._updateNormalizedSelection();
|
|
6504
|
-
}
|
|
6505
|
-
_updateNormalizedSelection() {
|
|
6506
|
-
const anchorBeforeFocus = this._anchor.y < this._originalFocus.y || this._anchor.y === this._originalFocus.y && this._anchor.x <= this._originalFocus.x;
|
|
6507
|
-
if (anchorBeforeFocus) {
|
|
6508
|
-
this._normalizedAnchor = { x: this._anchor.x, y: this._anchor.y };
|
|
6509
|
-
this._normalizedFocus = { ...this._originalFocus };
|
|
6510
|
-
} else {
|
|
6511
|
-
this._normalizedAnchor = { ...this._originalFocus };
|
|
6512
|
-
this._normalizedFocus = { x: this._anchor.x + 1, y: this._anchor.y };
|
|
6513
|
-
}
|
|
6506
|
+
this._focus = { ...value };
|
|
6514
6507
|
}
|
|
6515
6508
|
get isActive() {
|
|
6516
6509
|
return this._isActive;
|
|
@@ -6525,11 +6518,17 @@ class Selection {
|
|
|
6525
6518
|
this._isSelecting = value;
|
|
6526
6519
|
}
|
|
6527
6520
|
get bounds() {
|
|
6521
|
+
const minX = Math.min(this._anchor.x, this._focus.x);
|
|
6522
|
+
const maxX = Math.max(this._anchor.x, this._focus.x);
|
|
6523
|
+
const minY = Math.min(this._anchor.y, this._focus.y);
|
|
6524
|
+
const maxY = Math.max(this._anchor.y, this._focus.y);
|
|
6525
|
+
const width = maxX - minX + 1;
|
|
6526
|
+
const height = maxY - minY + 1;
|
|
6528
6527
|
return {
|
|
6529
|
-
x:
|
|
6530
|
-
y:
|
|
6531
|
-
width
|
|
6532
|
-
height
|
|
6528
|
+
x: minX,
|
|
6529
|
+
y: minY,
|
|
6530
|
+
width,
|
|
6531
|
+
height
|
|
6533
6532
|
};
|
|
6534
6533
|
}
|
|
6535
6534
|
updateSelectedRenderables(selectedRenderables) {
|
|
@@ -10567,6 +10566,14 @@ function getOpenTUILib(libPath) {
|
|
|
10567
10566
|
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr"],
|
|
10568
10567
|
returns: "bool"
|
|
10569
10568
|
},
|
|
10569
|
+
textBufferViewUpdateSelection: {
|
|
10570
|
+
args: ["ptr", "u32", "ptr", "ptr"],
|
|
10571
|
+
returns: "void"
|
|
10572
|
+
},
|
|
10573
|
+
textBufferViewUpdateLocalSelection: {
|
|
10574
|
+
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr"],
|
|
10575
|
+
returns: "bool"
|
|
10576
|
+
},
|
|
10570
10577
|
textBufferViewResetLocalSelection: {
|
|
10571
10578
|
args: ["ptr"],
|
|
10572
10579
|
returns: "void"
|
|
@@ -10639,6 +10646,10 @@ function getOpenTUILib(libPath) {
|
|
|
10639
10646
|
args: ["ptr", "u32", "u32"],
|
|
10640
10647
|
returns: "void"
|
|
10641
10648
|
},
|
|
10649
|
+
editorViewSetViewport: {
|
|
10650
|
+
args: ["ptr", "u32", "u32", "u32", "u32", "bool"],
|
|
10651
|
+
returns: "void"
|
|
10652
|
+
},
|
|
10642
10653
|
editorViewGetViewport: {
|
|
10643
10654
|
args: ["ptr", "ptr", "ptr", "ptr", "ptr"],
|
|
10644
10655
|
returns: "void"
|
|
@@ -10844,7 +10855,15 @@ function getOpenTUILib(libPath) {
|
|
|
10844
10855
|
returns: "u64"
|
|
10845
10856
|
},
|
|
10846
10857
|
editorViewSetLocalSelection: {
|
|
10847
|
-
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr"],
|
|
10858
|
+
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr", "bool"],
|
|
10859
|
+
returns: "bool"
|
|
10860
|
+
},
|
|
10861
|
+
editorViewUpdateSelection: {
|
|
10862
|
+
args: ["ptr", "u32", "ptr", "ptr"],
|
|
10863
|
+
returns: "void"
|
|
10864
|
+
},
|
|
10865
|
+
editorViewUpdateLocalSelection: {
|
|
10866
|
+
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr", "bool"],
|
|
10848
10867
|
returns: "bool"
|
|
10849
10868
|
},
|
|
10850
10869
|
editorViewResetLocalSelection: {
|
|
@@ -11593,6 +11612,16 @@ class FFIRenderLib {
|
|
|
11593
11612
|
const fg2 = fgColor ? fgColor.buffer : null;
|
|
11594
11613
|
return this.opentui.symbols.textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
|
|
11595
11614
|
}
|
|
11615
|
+
textBufferViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
11616
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
11617
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
11618
|
+
this.opentui.symbols.textBufferViewUpdateSelection(view, end, bg2, fg2);
|
|
11619
|
+
}
|
|
11620
|
+
textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
|
|
11621
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
11622
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
11623
|
+
return this.opentui.symbols.textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
|
|
11624
|
+
}
|
|
11596
11625
|
textBufferViewResetLocalSelection(view) {
|
|
11597
11626
|
this.opentui.symbols.textBufferViewResetLocalSelection(view);
|
|
11598
11627
|
}
|
|
@@ -11740,6 +11769,9 @@ class FFIRenderLib {
|
|
|
11740
11769
|
editorViewSetViewportSize(view, width, height) {
|
|
11741
11770
|
this.opentui.symbols.editorViewSetViewportSize(view, width, height);
|
|
11742
11771
|
}
|
|
11772
|
+
editorViewSetViewport(view, x, y, width, height, moveCursor) {
|
|
11773
|
+
this.opentui.symbols.editorViewSetViewport(view, x, y, width, height, moveCursor);
|
|
11774
|
+
}
|
|
11743
11775
|
editorViewGetViewport(view) {
|
|
11744
11776
|
const x = new Uint32Array(1);
|
|
11745
11777
|
const y = new Uint32Array(1);
|
|
@@ -11982,10 +12014,20 @@ class FFIRenderLib {
|
|
|
11982
12014
|
const end = Number(packedInfo & 0xffff_ffffn);
|
|
11983
12015
|
return { start, end };
|
|
11984
12016
|
}
|
|
11985
|
-
editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
|
|
12017
|
+
editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor) {
|
|
11986
12018
|
const bg2 = bgColor ? bgColor.buffer : null;
|
|
11987
12019
|
const fg2 = fgColor ? fgColor.buffer : null;
|
|
11988
|
-
return this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
|
|
12020
|
+
return this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor);
|
|
12021
|
+
}
|
|
12022
|
+
editorViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
12023
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
12024
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
12025
|
+
this.opentui.symbols.editorViewUpdateSelection(view, end, bg2, fg2);
|
|
12026
|
+
}
|
|
12027
|
+
editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor) {
|
|
12028
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
12029
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
12030
|
+
return this.opentui.symbols.editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor);
|
|
11989
12031
|
}
|
|
11990
12032
|
editorViewResetLocalSelection(view) {
|
|
11991
12033
|
this.opentui.symbols.editorViewResetLocalSelection(view);
|
|
@@ -14942,8 +14984,15 @@ import { EventEmitter as EventEmitter9 } from "events";
|
|
|
14942
14984
|
|
|
14943
14985
|
// src/lib/objects-in-viewport.ts
|
|
14944
14986
|
function getObjectsInViewport(viewport, objects, direction = "column", padding = 10, minTriggerSize = 16) {
|
|
14945
|
-
if (
|
|
14987
|
+
if (viewport.width <= 0 || viewport.height <= 0) {
|
|
14988
|
+
return [];
|
|
14989
|
+
}
|
|
14990
|
+
if (objects.length === 0) {
|
|
14991
|
+
return [];
|
|
14992
|
+
}
|
|
14993
|
+
if (objects.length < minTriggerSize) {
|
|
14946
14994
|
return objects;
|
|
14995
|
+
}
|
|
14947
14996
|
const viewportTop = viewport.y - padding;
|
|
14948
14997
|
const viewportBottom = viewport.y + viewport.height + padding;
|
|
14949
14998
|
const viewportLeft = viewport.x - padding;
|
|
@@ -16408,10 +16457,12 @@ Captured output:
|
|
|
16408
16457
|
this.clearSelection();
|
|
16409
16458
|
this.selectionContainers.push(renderable.parent || this.root);
|
|
16410
16459
|
this.currentSelection = new Selection(renderable, { x, y }, { x, y });
|
|
16460
|
+
this.currentSelection.isStart = true;
|
|
16411
16461
|
this.notifySelectablesOfSelectionChange();
|
|
16412
16462
|
}
|
|
16413
16463
|
updateSelection(currentRenderable, x, y) {
|
|
16414
16464
|
if (this.currentSelection) {
|
|
16465
|
+
this.currentSelection.isStart = false;
|
|
16415
16466
|
this.currentSelection.focus = { x, y };
|
|
16416
16467
|
if (this.selectionContainers.length > 0) {
|
|
16417
16468
|
const currentContainer = this.selectionContainers[this.selectionContainers.length - 1];
|
|
@@ -16453,6 +16504,7 @@ Captured output:
|
|
|
16453
16504
|
if (this.currentSelection) {
|
|
16454
16505
|
this.currentSelection.isSelecting = false;
|
|
16455
16506
|
this.emit("selection", this.currentSelection);
|
|
16507
|
+
this.notifySelectablesOfSelectionChange();
|
|
16456
16508
|
}
|
|
16457
16509
|
}
|
|
16458
16510
|
notifySelectablesOfSelectionChange() {
|
|
@@ -16471,7 +16523,7 @@ Captured output:
|
|
|
16471
16523
|
}
|
|
16472
16524
|
}
|
|
16473
16525
|
walkSelectableRenderables(container, selectionBounds, selectedRenderables, touchedRenderables) {
|
|
16474
|
-
const children = getObjectsInViewport(selectionBounds, container.getChildrenSortedByPrimaryAxis(), container.primaryAxis, 0);
|
|
16526
|
+
const children = getObjectsInViewport(selectionBounds, container.getChildrenSortedByPrimaryAxis(), container.primaryAxis, 0, 0);
|
|
16475
16527
|
for (const child of children) {
|
|
16476
16528
|
if (child.selectable) {
|
|
16477
16529
|
const hasSelection = child.onSelectionChanged(this.currentSelection);
|
|
@@ -16524,5 +16576,5 @@ Captured output:
|
|
|
16524
16576
|
|
|
16525
16577
|
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, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingKey, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
|
|
16526
16578
|
|
|
16527
|
-
//# debugId=
|
|
16528
|
-
//# sourceMappingURL=index-
|
|
16579
|
+
//# debugId=7D82DD76DE3E9D9064756E2164756E21
|
|
16580
|
+
//# sourceMappingURL=index-mrwvcpzb.js.map
|