@opentui/core 0.0.0-20251106-788e97e4 → 0.0.0-20251108-0c7899b1

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/Renderable.d.ts CHANGED
@@ -148,7 +148,6 @@ export declare abstract class Renderable extends BaseRenderable {
148
148
  parent: Renderable | null;
149
149
  private childrenPrimarySortDirty;
150
150
  private childrenSortedByPrimaryAxis;
151
- private _newChildren;
152
151
  onLifecyclePass: (() => void) | null;
153
152
  renderBefore?: (this: Renderable, buffer: OptimizedBuffer, deltaTime: number) => void;
154
153
  renderAfter?: (this: Renderable, buffer: OptimizedBuffer, deltaTime: number) => void;
@@ -241,7 +240,6 @@ export declare abstract class Renderable extends BaseRenderable {
241
240
  */
242
241
  protected onResize(width: number, height: number): void;
243
242
  private replaceParent;
244
- private _forceLayoutUpdateFor;
245
243
  add(obj: Renderable | VNode<any, any[]> | unknown, index?: number): number;
246
244
  insertBefore(obj: Renderable | VNode<any, any[]> | unknown, anchor?: Renderable | unknown): number;
247
245
  getRenderable(id: string): Renderable | undefined;
@@ -251,7 +249,7 @@ export declare abstract class Renderable extends BaseRenderable {
251
249
  getChildrenCount(): number;
252
250
  updateLayout(deltaTime: number, renderList?: RenderCommand[]): void;
253
251
  render(buffer: OptimizedBuffer, deltaTime: number): void;
254
- protected _getChildren(): Renderable[];
252
+ protected _getVisibleChildren(): number[];
255
253
  protected onUpdate(deltaTime: number): void;
256
254
  protected getScissorRect(): {
257
255
  x: number;
package/console.d.ts CHANGED
@@ -31,7 +31,7 @@ export declare class TerminalConsole extends EventEmitter {
31
31
  private isVisible;
32
32
  private isFocused;
33
33
  private renderer;
34
- private stdinHandler;
34
+ private keyHandler;
35
35
  private options;
36
36
  private _debugModeEnabled;
37
37
  private frameBuffer;
@@ -62,7 +62,7 @@ export declare class TerminalConsole extends EventEmitter {
62
62
  deactivate(): void;
63
63
  private _handleNewLog;
64
64
  private _updateConsoleDimensions;
65
- private handleStdin;
65
+ private handleKeyPress;
66
66
  private attachStdin;
67
67
  private detachStdin;
68
68
  private formatTimestamp;
@@ -27,7 +27,7 @@ var __export = (target, all) => {
27
27
  };
28
28
  var __require = import.meta.require;
29
29
 
30
- // ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/src/index.js
30
+ // ../../node_modules/yoga-layout/dist/src/index.js
31
31
  var exports_src = {};
32
32
  __export(exports_src, {
33
33
  default: () => src_default,
@@ -51,7 +51,7 @@ __export(exports_src, {
51
51
  Align: () => Align
52
52
  });
53
53
 
54
- // ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/binaries/yoga-wasm-base64-esm.js
54
+ // ../../node_modules/yoga-layout/dist/binaries/yoga-wasm-base64-esm.js
55
55
  var loadYoga = (() => {
56
56
  var _scriptDir = import.meta.url;
57
57
  return function(loadYoga2) {
@@ -1356,7 +1356,7 @@ var loadYoga = (() => {
1356
1356
  })();
1357
1357
  var yoga_wasm_base64_esm_default = loadYoga;
1358
1358
 
1359
- // ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/src/generated/YGEnums.js
1359
+ // ../../node_modules/yoga-layout/dist/src/generated/YGEnums.js
1360
1360
  var Align = /* @__PURE__ */ function(Align2) {
1361
1361
  Align2[Align2["Auto"] = 0] = "Auto";
1362
1362
  Align2[Align2["FlexStart"] = 1] = "FlexStart";
@@ -1559,7 +1559,7 @@ var constants = {
1559
1559
  };
1560
1560
  var YGEnums_default = constants;
1561
1561
 
1562
- // ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/src/wrapAssembly.js
1562
+ // ../../node_modules/yoga-layout/dist/src/wrapAssembly.js
1563
1563
  function wrapAssembly(lib) {
1564
1564
  function patch(prototype, name, fn) {
1565
1565
  const original = prototype[name];
@@ -1661,7 +1661,7 @@ function wrapAssembly(lib) {
1661
1661
  };
1662
1662
  }
1663
1663
 
1664
- // ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/src/index.js
1664
+ // ../../node_modules/yoga-layout/dist/src/index.js
1665
1665
  var Yoga = wrapAssembly(await yoga_wasm_base64_esm_default());
1666
1666
  var src_default = Yoga;
1667
1667
 
@@ -2079,6 +2079,7 @@ var isShiftKey = (code) => {
2079
2079
  var isCtrlKey = (code) => {
2080
2080
  return ["Oa", "Ob", "Oc", "Od", "Oe", "[2^", "[3^", "[5^", "[6^", "[7^", "[8^"].includes(code);
2081
2081
  };
2082
+ var ghosttyModifiedKeyRe = /^\x1b\[27;(\d+);(\d+)~$/;
2082
2083
  var parseKeypress = (s = "", options = {}) => {
2083
2084
  let parts;
2084
2085
  if (Buffer2.isBuffer(s)) {
@@ -2118,6 +2119,29 @@ var parseKeypress = (s = "", options = {}) => {
2118
2119
  return kittyResult;
2119
2120
  }
2120
2121
  }
2122
+ const ghosttyMatch = ghosttyModifiedKeyRe.exec(s);
2123
+ if (ghosttyMatch) {
2124
+ const modifier = parseInt(ghosttyMatch[1], 10) - 1;
2125
+ const charCode = parseInt(ghosttyMatch[2], 10);
2126
+ key.ctrl = !!(modifier & 4);
2127
+ key.meta = !!(modifier & 10);
2128
+ key.shift = !!(modifier & 1);
2129
+ key.option = !!(modifier & 2);
2130
+ if (charCode === 13) {
2131
+ key.name = "return";
2132
+ } else if (charCode === 27) {
2133
+ key.name = "escape";
2134
+ } else if (charCode === 9) {
2135
+ key.name = "tab";
2136
+ } else if (charCode === 32) {
2137
+ key.name = "space";
2138
+ } else if (charCode === 127 || charCode === 8) {
2139
+ key.name = "backspace";
2140
+ } else {
2141
+ key.name = String.fromCharCode(charCode);
2142
+ }
2143
+ return key;
2144
+ }
2121
2145
  if (s === "\r" || s === "\x1B\r") {
2122
2146
  key.name = "return";
2123
2147
  key.meta = s.length === 2;
@@ -7563,7 +7587,17 @@ class TerminalPalette {
7563
7587
  this.activeTimers.push(timer);
7564
7588
  inp.on("data", onData);
7565
7589
  this.activeListeners.push({ event: "data", handler: onData });
7566
- this.writeFn(["\x1B]10;?\x07", "\x1B]11;?\x07", "\x1B]12;?\x07", "\x1B]13;?\x07", "\x1B]14;?\x07", "\x1B]15;?\x07", "\x1B]16;?\x07", "\x1B]17;?\x07", "\x1B]19;?\x07"].join(""));
7590
+ this.writeFn([
7591
+ "\x1B]10;?\x07",
7592
+ "\x1B]11;?\x07",
7593
+ "\x1B]12;?\x07",
7594
+ "\x1B]13;?\x07",
7595
+ "\x1B]14;?\x07",
7596
+ "\x1B]15;?\x07",
7597
+ "\x1B]16;?\x07",
7598
+ "\x1B]17;?\x07",
7599
+ "\x1B]19;?\x07"
7600
+ ].join(""));
7567
7601
  });
7568
7602
  }
7569
7603
  async detect(options) {
@@ -7810,7 +7844,7 @@ class OptimizedBuffer {
7810
7844
  }
7811
7845
  }
7812
7846
 
7813
- // ../../node_modules/.bun/bun-ffi-structs@0.1.0+ca84541ac88a3075/node_modules/bun-ffi-structs/index.js
7847
+ // ../../node_modules/bun-ffi-structs/index.js
7814
7848
  import { ptr, toArrayBuffer as toArrayBuffer2 } from "bun:ffi";
7815
7849
  function fatalError(...args) {
7816
7850
  const message = args.join(" ");
@@ -8748,6 +8782,14 @@ function getOpenTUILib(libPath) {
8748
8782
  args: ["ptr", "u8"],
8749
8783
  returns: "void"
8750
8784
  },
8785
+ textBufferAppend: {
8786
+ args: ["ptr", "ptr", "usize"],
8787
+ returns: "void"
8788
+ },
8789
+ textBufferAppendFromMemId: {
8790
+ args: ["ptr", "u8"],
8791
+ returns: "void"
8792
+ },
8751
8793
  textBufferLoadFile: {
8752
8794
  args: ["ptr", "ptr", "usize"],
8753
8795
  returns: "bool"
@@ -9711,6 +9753,12 @@ class FFIRenderLib {
9711
9753
  textBufferSetTextFromMem(buffer, memId) {
9712
9754
  this.opentui.symbols.textBufferSetTextFromMem(buffer, memId);
9713
9755
  }
9756
+ textBufferAppend(buffer, bytes) {
9757
+ this.opentui.symbols.textBufferAppend(buffer, bytes, bytes.length);
9758
+ }
9759
+ textBufferAppendFromMemId(buffer, memId) {
9760
+ this.opentui.symbols.textBufferAppendFromMemId(buffer, memId);
9761
+ }
9714
9762
  textBufferLoadFile(buffer, path4) {
9715
9763
  const pathBytes = this.encoder.encode(path4);
9716
9764
  return this.opentui.symbols.textBufferLoadFile(buffer, pathBytes, pathBytes.length);
@@ -10352,6 +10400,7 @@ class TextBuffer {
10352
10400
  _syntaxStyle;
10353
10401
  _textBytes;
10354
10402
  _memId;
10403
+ _appendedChunks = [];
10355
10404
  constructor(lib, ptr4) {
10356
10405
  this.lib = lib;
10357
10406
  this.bufferPtr = ptr4;
@@ -10376,6 +10425,16 @@ class TextBuffer {
10376
10425
  this._length = this.lib.textBufferGetLength(this.bufferPtr);
10377
10426
  this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
10378
10427
  this._lineInfo = undefined;
10428
+ this._appendedChunks = [];
10429
+ }
10430
+ append(text) {
10431
+ this.guard();
10432
+ const textBytes = this.lib.encoder.encode(text);
10433
+ this._appendedChunks.push(textBytes);
10434
+ this.lib.textBufferAppend(this.bufferPtr, textBytes);
10435
+ this._length = this.lib.textBufferGetLength(this.bufferPtr);
10436
+ this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
10437
+ this._lineInfo = undefined;
10379
10438
  }
10380
10439
  loadFile(path4) {
10381
10440
  this.guard();
@@ -10501,6 +10560,7 @@ class TextBuffer {
10501
10560
  this._byteSize = 0;
10502
10561
  this._lineInfo = undefined;
10503
10562
  this._textBytes = undefined;
10563
+ this._appendedChunks = [];
10504
10564
  }
10505
10565
  reset() {
10506
10566
  this.guard();
@@ -10510,6 +10570,7 @@ class TextBuffer {
10510
10570
  this._lineInfo = undefined;
10511
10571
  this._textBytes = undefined;
10512
10572
  this._memId = undefined;
10573
+ this._appendedChunks = [];
10513
10574
  }
10514
10575
  destroy() {
10515
10576
  if (this._destroyed)
@@ -10693,7 +10754,6 @@ class Renderable extends BaseRenderable {
10693
10754
  parent = null;
10694
10755
  childrenPrimarySortDirty = true;
10695
10756
  childrenSortedByPrimaryAxis = [];
10696
- _newChildren = [];
10697
10757
  onLifecyclePass = null;
10698
10758
  renderBefore;
10699
10759
  renderAfter;
@@ -11351,7 +11411,6 @@ class Renderable extends BaseRenderable {
11351
11411
  }
11352
11412
  obj.parent = this;
11353
11413
  }
11354
- _forceLayoutUpdateFor = null;
11355
11414
  add(obj, index) {
11356
11415
  if (!obj) {
11357
11416
  return -1;
@@ -11385,7 +11444,6 @@ class Renderable extends BaseRenderable {
11385
11444
  this.propagateLiveCount(renderable._liveCount);
11386
11445
  }
11387
11446
  }
11388
- this._newChildren.push(renderable);
11389
11447
  const childLayoutNode = renderable.getLayoutNode();
11390
11448
  const insertedIndex = this._childrenInLayoutOrder.length;
11391
11449
  this._childrenInLayoutOrder.push(renderable);
@@ -11438,11 +11496,9 @@ class Renderable extends BaseRenderable {
11438
11496
  this.propagateLiveCount(renderable._liveCount);
11439
11497
  }
11440
11498
  }
11441
- this._newChildren.push(renderable);
11442
11499
  this.childrenPrimarySortDirty = true;
11443
11500
  const anchorIndex = this._childrenInLayoutOrder.indexOf(anchor);
11444
11501
  const insertedIndex = Math.max(0, Math.min(anchorIndex, this._childrenInLayoutOrder.length));
11445
- this._forceLayoutUpdateFor = this._childrenInLayoutOrder.slice(insertedIndex);
11446
11502
  this._childrenInLayoutOrder.splice(insertedIndex, 0, renderable);
11447
11503
  this.yogaNode.insertChild(renderable.getLayoutNode(), insertedIndex);
11448
11504
  this.requestRender();
@@ -11476,16 +11532,6 @@ class Renderable extends BaseRenderable {
11476
11532
  if (zIndexIndex !== -1) {
11477
11533
  this._childrenInZIndexOrder.splice(zIndexIndex, 1);
11478
11534
  }
11479
- if (this._forceLayoutUpdateFor) {
11480
- const forceIndex = this._forceLayoutUpdateFor.findIndex((obj2) => obj2.id === id);
11481
- if (forceIndex !== -1) {
11482
- this._forceLayoutUpdateFor?.splice(forceIndex, 1);
11483
- }
11484
- }
11485
- const newChildIndex = this._newChildren.findIndex((obj2) => obj2.id === id);
11486
- if (newChildIndex !== -1) {
11487
- this._newChildren?.splice(newChildIndex, 1);
11488
- }
11489
11535
  this.childrenPrimarySortDirty = true;
11490
11536
  }
11491
11537
  }
@@ -11503,18 +11549,6 @@ class Renderable extends BaseRenderable {
11503
11549
  this.onUpdate(deltaTime);
11504
11550
  this.updateFromLayout();
11505
11551
  renderList.push({ action: "render", renderable: this });
11506
- if (this._newChildren.length > 0) {
11507
- for (const child of this._newChildren) {
11508
- child.updateFromLayout();
11509
- }
11510
- this._newChildren = [];
11511
- }
11512
- if (this._forceLayoutUpdateFor) {
11513
- for (const child of this._forceLayoutUpdateFor) {
11514
- child.updateFromLayout();
11515
- }
11516
- this._forceLayoutUpdateFor = null;
11517
- }
11518
11552
  this.ensureZIndexSorted();
11519
11553
  const shouldPushScissor = this._overflow !== "visible" && this.width > 0 && this.height > 0;
11520
11554
  if (shouldPushScissor) {
@@ -11527,7 +11561,12 @@ class Renderable extends BaseRenderable {
11527
11561
  height: scissorRect.height
11528
11562
  });
11529
11563
  }
11530
- for (const child of this._getChildren()) {
11564
+ const visibleChildren = this._getVisibleChildren();
11565
+ for (const child of this._childrenInZIndexOrder) {
11566
+ if (!visibleChildren.includes(child.num)) {
11567
+ child.updateFromLayout();
11568
+ continue;
11569
+ }
11531
11570
  child.updateLayout(deltaTime, renderList);
11532
11571
  }
11533
11572
  if (shouldPushScissor) {
@@ -11552,8 +11591,8 @@ class Renderable extends BaseRenderable {
11552
11591
  buffer.drawFrameBuffer(this.x, this.y, this.frameBuffer);
11553
11592
  }
11554
11593
  }
11555
- _getChildren() {
11556
- return this._childrenInZIndexOrder;
11594
+ _getVisibleChildren() {
11595
+ return this._childrenInZIndexOrder.map((child) => child.num);
11557
11596
  }
11558
11597
  onUpdate(deltaTime) {}
11559
11598
  getScissorRect() {
@@ -12150,7 +12189,7 @@ class TerminalConsole extends EventEmitter8 {
12150
12189
  isVisible = false;
12151
12190
  isFocused = false;
12152
12191
  renderer;
12153
- stdinHandler;
12192
+ keyHandler;
12154
12193
  options;
12155
12194
  _debugModeEnabled = false;
12156
12195
  frameBuffer = null;
@@ -12188,7 +12227,7 @@ class TerminalConsole extends EventEmitter8 {
12188
12227
  super();
12189
12228
  this.renderer = renderer;
12190
12229
  this.options = { ...DEFAULT_CONSOLE_OPTIONS, ...options };
12191
- this.stdinHandler = this.handleStdin.bind(this);
12230
+ this.keyHandler = this.handleKeyPress.bind(this);
12192
12231
  this._debugModeEnabled = this.options.startInDebugMode;
12193
12232
  terminalConsoleCache.setCollectCallerInfo(this._debugModeEnabled);
12194
12233
  this._rgbaInfo = parseColor(this.options.colorInfo);
@@ -12267,75 +12306,65 @@ class TerminalConsole extends EventEmitter8 {
12267
12306
  }
12268
12307
  this.currentLineIndex = Math.max(0, Math.min(this.currentLineIndex, this.consoleHeight - 1));
12269
12308
  }
12270
- handleStdin(data) {
12271
- const key = data.toString();
12309
+ handleKeyPress(event) {
12272
12310
  let needsRedraw = false;
12273
12311
  const displayLineCount = this._displayLines.length;
12274
12312
  const logAreaHeight = Math.max(1, this.consoleHeight - 1);
12275
12313
  const maxScrollTop = Math.max(0, displayLineCount - logAreaHeight);
12276
12314
  const currentPositionIndex = this._positions.indexOf(this.options.position);
12277
- switch (key) {
12278
- case "\x1B":
12279
- this.blur();
12280
- break;
12281
- case "\x1B[1;2A":
12282
- if (this.scrollTopIndex > 0 || this.currentLineIndex > 0) {
12283
- this.scrollTopIndex = 0;
12284
- this.currentLineIndex = 0;
12285
- this.isScrolledToBottom = this._displayLines.length <= Math.max(1, this.consoleHeight - 1);
12286
- needsRedraw = true;
12287
- }
12288
- break;
12289
- case "\x1B[1;2B":
12290
- const logAreaHeightForScroll = Math.max(1, this.consoleHeight - 1);
12291
- const maxScrollPossible = Math.max(0, this._displayLines.length - logAreaHeightForScroll);
12292
- if (this.scrollTopIndex < maxScrollPossible || !this.isScrolledToBottom) {
12293
- this._scrollToBottom(true);
12294
- needsRedraw = true;
12295
- }
12296
- break;
12297
- case "\x1B[A":
12298
- if (this.currentLineIndex > 0) {
12299
- this.currentLineIndex--;
12300
- needsRedraw = true;
12301
- } else if (this.scrollTopIndex > 0) {
12302
- this.scrollTopIndex--;
12303
- this.isScrolledToBottom = false;
12304
- needsRedraw = true;
12305
- }
12306
- break;
12307
- case "\x1B[B":
12308
- const canCursorMoveDown = this.currentLineIndex < logAreaHeight - 1 && this.scrollTopIndex + this.currentLineIndex < displayLineCount - 1;
12309
- if (canCursorMoveDown) {
12310
- this.currentLineIndex++;
12311
- needsRedraw = true;
12312
- } else if (this.scrollTopIndex < maxScrollTop) {
12313
- this.scrollTopIndex++;
12314
- this.isScrolledToBottom = this.scrollTopIndex === maxScrollTop;
12315
- needsRedraw = true;
12316
- }
12317
- break;
12318
- case "\x10":
12319
- const prevIndex = (currentPositionIndex - 1 + this._positions.length) % this._positions.length;
12320
- this.options.position = this._positions[prevIndex];
12321
- this.resize(this.renderer.terminalWidth, this.renderer.terminalHeight);
12322
- break;
12323
- case "\x0F":
12324
- const nextIndex = (currentPositionIndex + 1) % this._positions.length;
12325
- this.options.position = this._positions[nextIndex];
12326
- this.resize(this.renderer.terminalWidth, this.renderer.terminalHeight);
12327
- break;
12328
- case "+":
12329
- this.options.sizePercent = Math.min(100, this.options.sizePercent + 5);
12330
- this.resize(this.renderer.terminalWidth, this.renderer.terminalHeight);
12331
- break;
12332
- case "-":
12333
- this.options.sizePercent = Math.max(10, this.options.sizePercent - 5);
12334
- this.resize(this.renderer.terminalWidth, this.renderer.terminalHeight);
12335
- break;
12336
- case "\x13":
12337
- this.saveLogsToFile();
12338
- break;
12315
+ if (event.name === "escape") {
12316
+ this.blur();
12317
+ return;
12318
+ }
12319
+ if (event.name === "up" && event.shift) {
12320
+ if (this.scrollTopIndex > 0 || this.currentLineIndex > 0) {
12321
+ this.scrollTopIndex = 0;
12322
+ this.currentLineIndex = 0;
12323
+ this.isScrolledToBottom = this._displayLines.length <= Math.max(1, this.consoleHeight - 1);
12324
+ needsRedraw = true;
12325
+ }
12326
+ } else if (event.name === "down" && event.shift) {
12327
+ const logAreaHeightForScroll = Math.max(1, this.consoleHeight - 1);
12328
+ const maxScrollPossible = Math.max(0, this._displayLines.length - logAreaHeightForScroll);
12329
+ if (this.scrollTopIndex < maxScrollPossible || !this.isScrolledToBottom) {
12330
+ this._scrollToBottom(true);
12331
+ needsRedraw = true;
12332
+ }
12333
+ } else if (event.name === "up") {
12334
+ if (this.currentLineIndex > 0) {
12335
+ this.currentLineIndex--;
12336
+ needsRedraw = true;
12337
+ } else if (this.scrollTopIndex > 0) {
12338
+ this.scrollTopIndex--;
12339
+ this.isScrolledToBottom = false;
12340
+ needsRedraw = true;
12341
+ }
12342
+ } else if (event.name === "down") {
12343
+ const canCursorMoveDown = this.currentLineIndex < logAreaHeight - 1 && this.scrollTopIndex + this.currentLineIndex < displayLineCount - 1;
12344
+ if (canCursorMoveDown) {
12345
+ this.currentLineIndex++;
12346
+ needsRedraw = true;
12347
+ } else if (this.scrollTopIndex < maxScrollTop) {
12348
+ this.scrollTopIndex++;
12349
+ this.isScrolledToBottom = this.scrollTopIndex === maxScrollTop;
12350
+ needsRedraw = true;
12351
+ }
12352
+ } else if (event.name === "p" && event.ctrl) {
12353
+ const prevIndex = (currentPositionIndex - 1 + this._positions.length) % this._positions.length;
12354
+ this.options.position = this._positions[prevIndex];
12355
+ this.resize(this.renderer.terminalWidth, this.renderer.terminalHeight);
12356
+ } else if (event.name === "o" && event.ctrl) {
12357
+ const nextIndex = (currentPositionIndex + 1) % this._positions.length;
12358
+ this.options.position = this._positions[nextIndex];
12359
+ this.resize(this.renderer.terminalWidth, this.renderer.terminalHeight);
12360
+ } else if (event.name === "+" || event.name === "=" && event.shift) {
12361
+ this.options.sizePercent = Math.min(100, this.options.sizePercent + 5);
12362
+ this.resize(this.renderer.terminalWidth, this.renderer.terminalHeight);
12363
+ } else if (event.name === "-") {
12364
+ this.options.sizePercent = Math.max(10, this.options.sizePercent - 5);
12365
+ this.resize(this.renderer.terminalWidth, this.renderer.terminalHeight);
12366
+ } else if (event.name === "s" && event.ctrl) {
12367
+ this.saveLogsToFile();
12339
12368
  }
12340
12369
  if (needsRedraw) {
12341
12370
  this.markNeedsRerender();
@@ -12344,13 +12373,13 @@ class TerminalConsole extends EventEmitter8 {
12344
12373
  attachStdin() {
12345
12374
  if (this.isFocused)
12346
12375
  return;
12347
- process.stdin.on("data", this.stdinHandler);
12376
+ this.renderer.keyInput.on("keypress", this.keyHandler);
12348
12377
  this.isFocused = true;
12349
12378
  }
12350
12379
  detachStdin() {
12351
12380
  if (!this.isFocused)
12352
12381
  return;
12353
- process.stdin.off("data", this.stdinHandler);
12382
+ this.renderer.keyInput.off("keypress", this.keyHandler);
12354
12383
  this.isFocused = false;
12355
12384
  }
12356
12385
  formatTimestamp(date) {
@@ -13014,9 +13043,6 @@ Captured output:
13014
13043
  process.on("uncaughtException", this.handleError);
13015
13044
  process.on("unhandledRejection", this.handleError);
13016
13045
  process.on("exit", this.exitHandler);
13017
- this._console = new TerminalConsole(this, config.consoleOptions);
13018
- this.useConsole = config.useConsole ?? true;
13019
- this._openConsoleOnError = config.openConsoleOnError ?? true;
13020
13046
  this._keyHandler = new InternalKeyHandler(this.stdin, config.useKittyKeyboard ?? true);
13021
13047
  this._keyHandler.on("keypress", (event) => {
13022
13048
  if (this.exitOnCtrlC && event.name === "c" && event.ctrl) {
@@ -13026,6 +13052,9 @@ Captured output:
13026
13052
  return;
13027
13053
  }
13028
13054
  });
13055
+ this._console = new TerminalConsole(this, config.consoleOptions);
13056
+ this.useConsole = config.useConsole ?? true;
13057
+ this._openConsoleOnError = config.openConsoleOnError ?? true;
13029
13058
  global.requestAnimationFrame = (callback) => {
13030
13059
  const id = CliRenderer.animationFrameId++;
13031
13060
  this.animationRequest.set(id, callback);
@@ -13972,5 +14001,5 @@ Captured output:
13972
14001
 
13973
14002
  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, TerminalPalette, createTerminalPalette, 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 };
13974
14003
 
13975
- //# debugId=064478AA2D709FB664756E2164756E21
13976
- //# sourceMappingURL=index-pb1pm3hk.js.map
14004
+ //# debugId=FE3334220FB993E564756E2164756E21
14005
+ //# sourceMappingURL=index-z5bb2h2z.js.map