@opentui/core 0.5.7 → 0.5.9

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.
@@ -5996,7 +5996,7 @@ class MouseParser {
5996
5996
  if (type === "down" && button !== 3) {
5997
5997
  this.mouseButtonsPressed.add(button);
5998
5998
  } else if (type === "up") {
5999
- this.mouseButtonsPressed.clear();
5999
+ this.mouseButtonsPressed.delete(button);
6000
6000
  }
6001
6001
  }
6002
6002
  return {
@@ -11555,7 +11555,6 @@ class TextBuffer {
11555
11555
  bufferPtr;
11556
11556
  _length = 0;
11557
11557
  _byteSize = 0;
11558
- _lineInfo;
11559
11558
  _destroyed = false;
11560
11559
  _syntaxStyle;
11561
11560
  _textBytes;
@@ -11584,7 +11583,6 @@ class TextBuffer {
11584
11583
  this.lib.textBufferSetTextFromMem(this.bufferPtr, this._memId);
11585
11584
  this._length = this.lib.textBufferGetLength(this.bufferPtr);
11586
11585
  this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
11587
- this._lineInfo = undefined;
11588
11586
  this._appendedChunks = [];
11589
11587
  }
11590
11588
  append(text) {
@@ -11594,7 +11592,6 @@ class TextBuffer {
11594
11592
  this.lib.textBufferAppend(this.bufferPtr, textBytes);
11595
11593
  this._length = this.lib.textBufferGetLength(this.bufferPtr);
11596
11594
  this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
11597
- this._lineInfo = undefined;
11598
11595
  }
11599
11596
  loadFile(path3) {
11600
11597
  this.guard();
@@ -11604,7 +11601,6 @@ class TextBuffer {
11604
11601
  }
11605
11602
  this._length = this.lib.textBufferGetLength(this.bufferPtr);
11606
11603
  this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
11607
- this._lineInfo = undefined;
11608
11604
  this._textBytes = undefined;
11609
11605
  }
11610
11606
  setStyledText(text) {
@@ -11612,7 +11608,6 @@ class TextBuffer {
11612
11608
  this.lib.textBufferSetStyledText(this.bufferPtr, text.chunks);
11613
11609
  this._length = this.lib.textBufferGetLength(this.bufferPtr);
11614
11610
  this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
11615
- this._lineInfo = undefined;
11616
11611
  }
11617
11612
  setDefaultFg(fg2) {
11618
11613
  this.guard();
@@ -11707,6 +11702,7 @@ class TextBuffer {
11707
11702
  setTabWidth(width) {
11708
11703
  this.guard();
11709
11704
  this.lib.textBufferSetTabWidth(this.bufferPtr, width);
11705
+ this._length = this.lib.textBufferGetLength(this.bufferPtr);
11710
11706
  }
11711
11707
  getTabWidth() {
11712
11708
  this.guard();
@@ -11717,7 +11713,6 @@ class TextBuffer {
11717
11713
  this.lib.textBufferClear(this.bufferPtr);
11718
11714
  this._length = 0;
11719
11715
  this._byteSize = 0;
11720
- this._lineInfo = undefined;
11721
11716
  this._textBytes = undefined;
11722
11717
  this._appendedChunks = [];
11723
11718
  }
@@ -11726,7 +11721,6 @@ class TextBuffer {
11726
11721
  this.lib.textBufferReset(this.bufferPtr);
11727
11722
  this._length = 0;
11728
11723
  this._byteSize = 0;
11729
- this._lineInfo = undefined;
11730
11724
  this._textBytes = undefined;
11731
11725
  this._memId = undefined;
11732
11726
  this._appendedChunks = [];
@@ -13099,7 +13093,7 @@ var VisualCursorStruct = defineStruct([
13099
13093
  ["logicalCol", "u32"],
13100
13094
  ["offset", "u32"]
13101
13095
  ]);
13102
- var UnicodeMethodEnum = defineEnum({ wcwidth: 0, unicode: 1 }, "u8");
13096
+ var UnicodeMethodEnum = defineEnum({ wcwidth: 0, unicode: 1, "unicode-wide": 3 }, "u8");
13103
13097
  var TerminalMultiplexerEnum = defineEnum({ none: 0, tmux: 1, zellij: 2, screen: 3, unknown: 4 }, "u8");
13104
13098
  var Osc52SupportEnum = defineEnum({ unknown: 0, supported: 1, unsupported: 2 }, "u8");
13105
13099
  var ImageProtocolEnum = defineEnum({ auto: 0, kitty: 1, sixel: 2, blocks: 3 }, "u8");
@@ -13573,6 +13567,14 @@ function selectionBehaviorByte(behavior) {
13573
13567
  function editorLocalSelectionFlags(updateCursor, followCursor, behavior) {
13574
13568
  return ffiBool(updateCursor) | ffiBool(followCursor) << 1 | selectionBehaviorByte(behavior) << 2;
13575
13569
  }
13570
+ function widthMethodCode(widthMethod) {
13571
+ return widthMethod === "wcwidth" ? 0 : widthMethod === "unicode-wide" ? 3 : 1;
13572
+ }
13573
+ function widthMethodFromCode(code) {
13574
+ if (code === 0)
13575
+ return "wcwidth";
13576
+ return code === 3 ? "unicode-wide" : "unicode";
13577
+ }
13576
13578
  function getOpenTUILib(libPath) {
13577
13579
  const resolvedLibPath = libPath || targetLibPath;
13578
13580
  if (!resolvedLibPath) {
@@ -13783,6 +13785,10 @@ function getOpenTUILib(libPath) {
13783
13785
  args: ["u32"],
13784
13786
  returns: "u32"
13785
13787
  },
13788
+ getBufferWidthMethod: {
13789
+ args: ["u32"],
13790
+ returns: "u8"
13791
+ },
13786
13792
  bufferClear: {
13787
13793
  args: ["u32", "buffer"],
13788
13794
  returns: "void"
@@ -14400,7 +14406,7 @@ function getOpenTUILib(libPath) {
14400
14406
  },
14401
14407
  editorViewGetViewport: {
14402
14408
  args: ["u32", "buffer", "buffer", "buffer", "buffer"],
14403
- returns: "void"
14409
+ returns: "bool"
14404
14410
  },
14405
14411
  editorViewSetScrollMargin: {
14406
14412
  args: ["u32", "f32"],
@@ -14530,6 +14536,10 @@ function getOpenTUILib(libPath) {
14530
14536
  args: ["u32"],
14531
14537
  returns: "u32"
14532
14538
  },
14539
+ editBufferSetTabWidth: {
14540
+ args: ["u32", "u8"],
14541
+ returns: "void"
14542
+ },
14533
14543
  editBufferDebugLogRope: {
14534
14544
  args: ["u32"],
14535
14545
  returns: "void"
@@ -15759,7 +15769,8 @@ class FFIRenderLib {
15759
15769
  }
15760
15770
  const width = this.opentui.symbols.getBufferWidth(bufferPtr);
15761
15771
  const height = this.opentui.symbols.getBufferHeight(bufferPtr);
15762
- return new OptimizedBuffer(this, bufferPtr, width, height, { id: "next buffer", widthMethod: "unicode" });
15772
+ const widthMethod = widthMethodFromCode(this.opentui.symbols.getBufferWidthMethod(bufferPtr));
15773
+ return new OptimizedBuffer(this, bufferPtr, width, height, { id: "next buffer", widthMethod });
15763
15774
  }
15764
15775
  getCurrentBuffer(renderer) {
15765
15776
  const bufferPtr = this.opentui.symbols.getCurrentBuffer(renderer);
@@ -15768,7 +15779,8 @@ class FFIRenderLib {
15768
15779
  }
15769
15780
  const width = this.opentui.symbols.getBufferWidth(bufferPtr);
15770
15781
  const height = this.opentui.symbols.getBufferHeight(bufferPtr);
15771
- return new OptimizedBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod: "unicode" });
15782
+ const widthMethod = widthMethodFromCode(this.opentui.symbols.getBufferWidthMethod(bufferPtr));
15783
+ return new OptimizedBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod });
15772
15784
  }
15773
15785
  rendererSetPaletteState(renderer, palette, defaultForeground, defaultBackground, paletteEpoch) {
15774
15786
  const paletteBuffer = new Uint16Array(palette.length * 4);
@@ -15972,10 +15984,9 @@ class FFIRenderLib {
15972
15984
  if (Number.isNaN(width) || Number.isNaN(height)) {
15973
15985
  console.error(new Error(`Invalid dimensions for OptimizedBuffer: ${width}x${height}`).stack);
15974
15986
  }
15975
- const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
15976
15987
  const idToUse = id || "unnamed buffer";
15977
15988
  const idBytes = this.encoder.encode(idToUse);
15978
- const bufferPtr = this.opentui.symbols.createOptimizedBuffer(width, height, ffiBool(respectAlpha), widthMethodCode, idBytes, idBytes.byteLength);
15989
+ const bufferPtr = this.opentui.symbols.createOptimizedBuffer(width, height, ffiBool(respectAlpha), widthMethodCode(widthMethod), idBytes, idBytes.byteLength);
15979
15990
  if (!bufferPtr) {
15980
15991
  throw new Error(`Failed to create optimized buffer: ${width}x${height}`);
15981
15992
  }
@@ -16365,8 +16376,7 @@ class FFIRenderLib {
16365
16376
  });
16366
16377
  }
16367
16378
  createTextBuffer(widthMethod) {
16368
- const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
16369
- const bufferPtr = this.opentui.symbols.createTextBuffer(widthMethodCode);
16379
+ const bufferPtr = this.opentui.symbols.createTextBuffer(widthMethodCode(widthMethod));
16370
16380
  if (!bufferPtr) {
16371
16381
  throw new Error(`Failed to create TextBuffer`);
16372
16382
  }
@@ -16768,8 +16778,7 @@ class FFIRenderLib {
16768
16778
  };
16769
16779
  }
16770
16780
  createEditBuffer(widthMethod) {
16771
- const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
16772
- const bufferPtr = this.opentui.symbols.createEditBuffer(widthMethodCode, this.eventSinkPtr ?? 0);
16781
+ const bufferPtr = this.opentui.symbols.createEditBuffer(widthMethodCode(widthMethod), this.eventSinkPtr ?? 0);
16773
16782
  if (!bufferPtr) {
16774
16783
  throw new Error("Failed to create EditBuffer");
16775
16784
  }
@@ -16861,6 +16870,9 @@ class FFIRenderLib {
16861
16870
  }
16862
16871
  return result;
16863
16872
  }
16873
+ editBufferSetTabWidth(buffer, width) {
16874
+ this.opentui.symbols.editBufferSetTabWidth(buffer, width);
16875
+ }
16864
16876
  editBufferDebugLogRope(buffer) {
16865
16877
  this.opentui.symbols.editBufferDebugLogRope(buffer);
16866
16878
  }
@@ -17124,10 +17136,9 @@ class FFIRenderLib {
17124
17136
  }
17125
17137
  encodeUnicode(text, widthMethod) {
17126
17138
  const textBytes = this.encoder.encode(text);
17127
- const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
17128
17139
  const outPtrBuffer = new ArrayBuffer(8);
17129
17140
  const outLenBuffer = new ArrayBuffer(8);
17130
- const success = this.opentui.symbols.encodeUnicode(viewOrNull(textBytes), textBytes.byteLength, outPtrBuffer, outLenBuffer, widthMethodCode);
17141
+ const success = this.opentui.symbols.encodeUnicode(viewOrNull(textBytes), textBytes.byteLength, outPtrBuffer, outLenBuffer, widthMethodCode(widthMethod));
17131
17142
  if (!success) {
17132
17143
  return null;
17133
17144
  }
@@ -18578,5 +18589,5 @@ var yoga_default = Yoga;
18578
18589
 
18579
18590
  export { toArrayBuffer, singleton, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, sleep, stringWidth2 as stringWidth, resolveBundledFilePath, DEFAULT_FOREGROUND_RGB, DEFAULT_BACKGROUND_RGB, normalizeIndexedColorIndex, ansi256IndexToRgb, RGBA, normalizeColorValue, hexToRgb, rgbToHex, hsvToRgb, parseColor, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, createTextAttributes, attributesWithLink, getLinkId, 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, link, t, hastToStyledText, SystemClock, nonAlphanumericKeys, terminalNamedSingleStrokeKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, getTreeSitterClient, destroyTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, normalizeTerminalPalette, buildTerminalPaletteSignature, decodePasteBytes, stripAnsiSequences, createHostClipboard, createClipboard, ClipboardTarget, createRendererClipboardAdapter, Clipboard, detectLinks, OptimizedBuffer, TextBuffer, SpanInfoStruct, NativeAudioStreamFormat, NativeAudioStreamState, NativeAudioStreamStateNames, NativeAudioStreamCloseReason, NativeAudioStreamState2 as NativeAudioStreamState1, NativeAudioStreamCloseReason2 as NativeAudioStreamCloseReason1, NativeAudioStreamFormat2 as NativeAudioStreamFormat1, NativeClipboardOperationStatus, NativeClipboardStartStatus, NativeClipboardCancelStatus, NativeClipboardCopyStatus, NativeClipboardDestroyStatus, NativeClipboardShutdownStatus, LogLevel2 as LogLevel, NativeMeasureTargetKind, setRenderLibPath, resolveRenderLib, Align, BoxSizing, Dimension, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, LogLevel as LogLevel1, MeasureMode, NodeType, Overflow, PositionType, Unit, Wrap, ALIGN_AUTO, ALIGN_FLEX_START, ALIGN_CENTER, ALIGN_FLEX_END, ALIGN_STRETCH, ALIGN_BASELINE, ALIGN_SPACE_BETWEEN, ALIGN_SPACE_AROUND, ALIGN_SPACE_EVENLY, BOX_SIZING_BORDER_BOX, BOX_SIZING_CONTENT_BOX, DIMENSION_WIDTH, DIMENSION_HEIGHT, DIRECTION_INHERIT, DIRECTION_LTR, DIRECTION_RTL, DISPLAY_FLEX, DISPLAY_NONE, DISPLAY_CONTENTS, EDGE_LEFT, EDGE_TOP, EDGE_RIGHT, EDGE_BOTTOM, EDGE_START, EDGE_END, EDGE_HORIZONTAL, EDGE_VERTICAL, EDGE_ALL, ERRATA_NONE, ERRATA_STRETCH_FLEX_BASIS, ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING, ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE, ERRATA_ALL, ERRATA_CLASSIC, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS, FLEX_DIRECTION_COLUMN, FLEX_DIRECTION_COLUMN_REVERSE, FLEX_DIRECTION_ROW, FLEX_DIRECTION_ROW_REVERSE, GUTTER_COLUMN, GUTTER_ROW, GUTTER_ALL, JUSTIFY_FLEX_START, JUSTIFY_CENTER, JUSTIFY_FLEX_END, JUSTIFY_SPACE_BETWEEN, JUSTIFY_SPACE_AROUND, JUSTIFY_SPACE_EVENLY, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_VERBOSE, LOG_LEVEL_FATAL, MEASURE_MODE_UNDEFINED, MEASURE_MODE_EXACTLY, MEASURE_MODE_AT_MOST, NODE_TYPE_DEFAULT, NODE_TYPE_TEXT, OVERFLOW_VISIBLE, OVERFLOW_HIDDEN, OVERFLOW_SCROLL, POSITION_TYPE_STATIC, POSITION_TYPE_RELATIVE, POSITION_TYPE_ABSOLUTE, UNIT_UNDEFINED, UNIT_POINT, UNIT_PERCENT, UNIT_AUTO, WRAP_NO_WRAP, WRAP_WRAP, WRAP_WRAP_REVERSE, Config, Node, exports_yoga, yoga_default };
18580
18591
 
18581
- //# debugId=4B7BC8814EED9E3164756E2164756E21
18582
- //# sourceMappingURL=chunk-node-267dafd8.js.map
18592
+ //# debugId=87E358DA2E4BBC1B64756E2164756E21
18593
+ //# sourceMappingURL=chunk-node-zcz10bhr.js.map