@opentui/core 0.7.0 → 0.8.0

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.
Files changed (45) hide show
  1. package/NativeScene.d.ts +9 -3
  2. package/Renderable.d.ts +20 -2
  3. package/animation/Timeline.d.ts +9 -0
  4. package/buffer.d.ts +6 -2
  5. package/{chunk-bun-zevtbcf6.js → chunk-bun-6kxdhkdc.js} +407 -259
  6. package/chunk-bun-6kxdhkdc.js.map +70 -0
  7. package/{chunk-bun-qkpm62w1.js → chunk-bun-x6cz4jyg.js} +263 -21
  8. package/chunk-bun-x6cz4jyg.js.map +35 -0
  9. package/{chunk-node-7bcmqh18.js → chunk-node-q5ccgbk5.js} +407 -259
  10. package/{chunk-bun-zevtbcf6.js.map → chunk-node-q5ccgbk5.js.map} +15 -15
  11. package/{chunk-node-mzgnr3sw.js → chunk-node-y0w0hq5m.js} +263 -21
  12. package/chunk-node-y0w0hq5m.js.map +34 -0
  13. package/edit-buffer.d.ts +4 -0
  14. package/index.bun.js +788 -473
  15. package/index.bun.js.map +11 -10
  16. package/index.d.ts +1 -1
  17. package/index.node.js +788 -473
  18. package/index.node.js.map +11 -9
  19. package/lib/extmarks.d.ts +3 -1
  20. package/lib/stdin-parser-native.d.ts +2 -0
  21. package/lib/stdin-parser.d.ts +2 -0
  22. package/lib/terminal-capability-detection.d.ts +6 -1
  23. package/native-abi.generated.d.ts +307 -3
  24. package/package.json +9 -9
  25. package/renderables/FrameBuffer.d.ts +1 -0
  26. package/renderables/ScrollBar.d.ts +6 -0
  27. package/renderables/ScrollBox.d.ts +83 -43
  28. package/renderables/ScrollBoxParts.d.ts +165 -0
  29. package/renderables/index.d.ts +1 -1
  30. package/renderer-theme-mode.d.ts +1 -6
  31. package/renderer.d.ts +22 -3
  32. package/testing/test-renderer.d.ts +2 -0
  33. package/testing.bun.js +7 -6
  34. package/testing.bun.js.map +3 -3
  35. package/testing.js +7 -6
  36. package/testing.js.map +3 -3
  37. package/types.d.ts +11 -0
  38. package/yoga.bun.js +1 -1
  39. package/yoga.internal.d.ts +3 -3
  40. package/yoga.js +1 -1
  41. package/zig-structs.d.ts +1 -0
  42. package/zig.d.ts +78 -8
  43. package/chunk-bun-qkpm62w1.js.map +0 -35
  44. package/chunk-node-7bcmqh18.js.map +0 -70
  45. package/chunk-node-mzgnr3sw.js.map +0 -34
@@ -64,7 +64,7 @@ import {
64
64
  PositionType2,
65
65
  Unit2,
66
66
  Wrap2
67
- } from "./chunk-node-mzgnr3sw.js";
67
+ } from "./chunk-node-y0w0hq5m.js";
68
68
 
69
69
  // src/lib/border.ts
70
70
  var VALID_BORDER_STYLES = ["single", "double", "rounded", "heavy"];
@@ -4782,7 +4782,8 @@ var DEFAULT_PROTOCOL_CONTEXT = {
4782
4782
  privateCapabilityRepliesActive: false,
4783
4783
  pixelResolutionQueryActive: false,
4784
4784
  explicitWidthCprActive: false,
4785
- startupCursorCprActive: false
4785
+ startupCursorCprActive: false,
4786
+ replySentinelActive: false
4786
4787
  };
4787
4788
  var RXVT_DOLLAR_CSI_RE = /^\x1b\[\d+\$$/;
4788
4789
  var SYSTEM_CLOCK = new SystemClock2;
@@ -7958,20 +7959,16 @@ class ExtmarksController2 {
7958
7959
  const startCursor = this.offsetToPosition(virtualExtmark.start);
7959
7960
  const endCursor = this.offsetToPosition(virtualExtmark.end);
7960
7961
  const deleteOffset = virtualExtmark.start;
7961
- const deleteLength = virtualExtmark.end - virtualExtmark.start;
7962
- this.originalDeleteRange(startCursor.row, startCursor.col, endCursor.row, endCursor.col);
7962
+ const change = this.measureChange(() => this.originalDeleteRange(startCursor.row, startCursor.col, endCursor.row, endCursor.col));
7963
7963
  this.saveSnapshot();
7964
7964
  this.deleteExtmarkById(virtualExtmark.id);
7965
- this.adjustExtmarksAfterDeletion(deleteOffset, deleteLength);
7965
+ this.shiftExtmarks(deleteOffset, change);
7966
7966
  return;
7967
7967
  }
7968
- this.originalDeleteCharBackward();
7968
+ const deleteOffset = this.editBuffer._getPrevCharBoundary().offset;
7969
+ const change = this.measureChange(() => this.originalDeleteCharBackward());
7969
7970
  this.saveSnapshot();
7970
- const deleteOffset = this.editBuffer.getCursorPosition().offset;
7971
- const deleteLength = currentOffset - deleteOffset;
7972
- if (deleteLength > 0) {
7973
- this.adjustExtmarksAfterDeletion(deleteOffset, deleteLength);
7974
- }
7971
+ this.shiftExtmarks(deleteOffset, change);
7975
7972
  });
7976
7973
  this.editBuffer.deleteChar = () => this.editBuffer.runMutation(() => {
7977
7974
  if (this.destroyed) {
@@ -7991,32 +7988,25 @@ class ExtmarksController2 {
7991
7988
  const startCursor = this.offsetToPosition(virtualExtmark.start);
7992
7989
  const endCursor = this.offsetToPosition(virtualExtmark.end);
7993
7990
  const deleteOffset = virtualExtmark.start;
7994
- const deleteLength = virtualExtmark.end - virtualExtmark.start;
7995
- this.originalDeleteRange(startCursor.row, startCursor.col, endCursor.row, endCursor.col);
7991
+ const change = this.measureChange(() => this.originalDeleteRange(startCursor.row, startCursor.col, endCursor.row, endCursor.col));
7996
7992
  this.saveSnapshot();
7997
7993
  this.deleteExtmarkById(virtualExtmark.id);
7998
- this.adjustExtmarksAfterDeletion(deleteOffset, deleteLength);
7994
+ this.shiftExtmarks(deleteOffset, change);
7999
7995
  return;
8000
7996
  }
8001
- const deleteEndOffset = this.getNextCursorOffset(currentOffset);
8002
- const deleteLength = deleteEndOffset - currentOffset;
8003
- this.originalDeleteChar();
7997
+ const change = this.measureChange(() => this.originalDeleteChar());
8004
7998
  this.saveSnapshot();
8005
- if (deleteLength > 0) {
8006
- this.adjustExtmarksAfterDeletion(currentOffset, deleteLength);
8007
- }
7999
+ this.shiftExtmarks(currentOffset, change);
8008
8000
  });
8009
8001
  this.editBuffer.deleteRange = (startLine, startCol, endLine, endCol) => this.editBuffer.runMutation(() => {
8010
8002
  if (this.destroyed) {
8011
8003
  this.originalDeleteRange(startLine, startCol, endLine, endCol);
8012
8004
  return;
8013
8005
  }
8014
- const startOffset = this.positionToOffset(startLine, startCol);
8015
- const endOffset = this.positionToOffset(endLine, endCol);
8016
- const length = endOffset - startOffset;
8017
- this.originalDeleteRange(startLine, startCol, endLine, endCol);
8006
+ const startOffset = Math.min(this.positionToOffset(startLine, startCol), this.positionToOffset(endLine, endCol));
8007
+ const change = this.measureChange(() => this.originalDeleteRange(startLine, startCol, endLine, endCol));
8018
8008
  this.saveSnapshot();
8019
- this.adjustExtmarksAfterDeletion(startOffset, length);
8009
+ this.shiftExtmarks(startOffset, change);
8020
8010
  });
8021
8011
  this.editBuffer.deleteLine = () => this.editBuffer.runMutation(() => {
8022
8012
  if (this.destroyed) {
@@ -8038,12 +8028,9 @@ class ExtmarksController2 {
8038
8028
  return;
8039
8029
  }
8040
8030
  const currentOffset = this.editBuffer.getCursorPosition().offset;
8041
- this.originalInsertText(text);
8031
+ const change = this.measureChange(() => this.originalInsertText(text));
8042
8032
  this.saveSnapshot();
8043
- const insertLength = this.editBuffer.getCursorPosition().offset - currentOffset;
8044
- if (insertLength > 0) {
8045
- this.adjustExtmarksAfterInsertion(currentOffset, insertLength);
8046
- }
8033
+ this.shiftExtmarks(currentOffset, change);
8047
8034
  });
8048
8035
  this.editBuffer.insertChar = (char) => this.editBuffer.runMutation(() => {
8049
8036
  if (this.destroyed) {
@@ -8051,12 +8038,9 @@ class ExtmarksController2 {
8051
8038
  return;
8052
8039
  }
8053
8040
  const currentOffset = this.editBuffer.getCursorPosition().offset;
8054
- this.originalInsertChar(char);
8041
+ const change = this.measureChange(() => this.originalInsertChar(char));
8055
8042
  this.saveSnapshot();
8056
- const insertLength = this.editBuffer.getCursorPosition().offset - currentOffset;
8057
- if (insertLength > 0) {
8058
- this.adjustExtmarksAfterInsertion(currentOffset, insertLength);
8059
- }
8043
+ this.shiftExtmarks(currentOffset, change);
8060
8044
  });
8061
8045
  this.editBuffer.setText = (text) => {
8062
8046
  if (this.destroyed) {
@@ -8105,21 +8089,19 @@ class ExtmarksController2 {
8105
8089
  return this.originalEditorViewReplaceSelectedText(text);
8106
8090
  const selection = this.editorView.getSelection();
8107
8091
  const deleteOffset = selection ? Math.min(selection.start, selection.end) : 0;
8108
- const deleteLength = selection ? Math.abs(selection.end - selection.start) : 0;
8109
8092
  const cursorOffset = this.editBuffer.getCursorPosition().offset;
8110
- const result = this.originalEditorViewReplaceSelectedText(text);
8093
+ let result;
8094
+ const change = this.measureChange(() => result = this.originalEditorViewReplaceSelectedText(text));
8111
8095
  const insertOffset = result.deleted ? deleteOffset : cursorOffset;
8096
+ const insertLength = result.inserted ? this.editBuffer.getCursorPosition().offset - insertOffset : 0;
8112
8097
  if (result.deleted) {
8113
8098
  this.saveSnapshot();
8114
- if (deleteLength > 0)
8115
- this.adjustExtmarksAfterDeletion(deleteOffset, deleteLength, false);
8099
+ this.shiftExtmarks(deleteOffset, change - insertLength, false);
8116
8100
  }
8117
8101
  if (result.inserted)
8118
8102
  this.saveSnapshot();
8119
- const insertLength = this.editBuffer.getCursorPosition().offset - insertOffset;
8120
- if (insertLength > 0)
8121
- this.adjustExtmarksAfterInsertion(insertOffset, insertLength, false);
8122
- if (deleteLength > 0 || insertLength > 0)
8103
+ this.shiftExtmarks(insertOffset, insertLength, false);
8104
+ if (change !== 0 || insertLength !== 0)
8123
8105
  this.updateHighlights();
8124
8106
  return result;
8125
8107
  });
@@ -8135,12 +8117,9 @@ class ExtmarksController2 {
8135
8117
  return;
8136
8118
  }
8137
8119
  const deleteOffset = Math.min(selection.start, selection.end);
8138
- const deleteLength = Math.abs(selection.end - selection.start);
8139
- this.originalEditorViewDeleteSelectedText();
8120
+ const change = this.measureChange(() => this.originalEditorViewDeleteSelectedText());
8140
8121
  this.saveSnapshot();
8141
- if (deleteLength > 0) {
8142
- this.adjustExtmarksAfterDeletion(deleteOffset, deleteLength);
8143
- }
8122
+ this.shiftExtmarks(deleteOffset, change);
8144
8123
  });
8145
8124
  }
8146
8125
  setupContentChangeListener() {
@@ -8211,11 +8190,16 @@ class ExtmarksController2 {
8211
8190
  positionToOffset(row, col) {
8212
8191
  return this.editBuffer.positionToOffset(row, col);
8213
8192
  }
8214
- getNextCursorOffset(currentOffset) {
8215
- this.originalMoveCursorRight();
8216
- const nextOffset = this.editBuffer.getCursorPosition().offset;
8217
- this.originalSetCursorByOffset(currentOffset);
8218
- return nextOffset;
8193
+ measureChange(edit) {
8194
+ const before = this.editBuffer._getEOF().offset;
8195
+ edit();
8196
+ return this.editBuffer._getEOF().offset - before;
8197
+ }
8198
+ shiftExtmarks(offset, change, updateHighlights = true) {
8199
+ if (change > 0)
8200
+ this.adjustExtmarksAfterInsertion(offset, change, updateHighlights);
8201
+ else if (change < 0)
8202
+ this.adjustExtmarksAfterDeletion(offset, -change, updateHighlights);
8219
8203
  }
8220
8204
  updateHighlights() {
8221
8205
  this.editBuffer.clearAllHighlights();
@@ -9712,12 +9696,12 @@ class OptimizedBuffer2 {
9712
9696
  return recorder.draw(options);
9713
9697
  this.lib.contextDrawBuffer(this.checkedTarget(), options);
9714
9698
  }
9715
- _drawSceneText(scene, node, x, y) {
9699
+ _drawSceneBody(scene, node, x, y) {
9716
9700
  this.guard();
9717
9701
  const recorder = this.recorder;
9718
9702
  if (recorder)
9719
9703
  return recorder.view("scene", node, x, y);
9720
- this.lib.contextDrawSceneText(this._getSceneDrawTarget(scene), node, x, y);
9704
+ this.lib.contextDrawSceneBody(this._getSceneDrawTarget(scene), node, x, y);
9721
9705
  }
9722
9706
  get buffers() {
9723
9707
  this.guard();
@@ -10408,10 +10392,12 @@ class Renderable2 extends BaseRenderable2 {
10408
10392
  frameBuffer = null;
10409
10393
  _focusable = this.constructor.defaultFocusable;
10410
10394
  _focused = false;
10411
- _hasFocusedDescendant = false;
10412
10395
  keypressHandler = null;
10413
10396
  pasteHandler = null;
10414
10397
  _live = false;
10398
+ _animationFps;
10399
+ stopAnimationTick;
10400
+ animationDrawnFrame = -1;
10415
10401
  _liveCount = 0;
10416
10402
  _sizeChangeListener = undefined;
10417
10403
  _hooks = Renderable2.baseHooks;
@@ -10486,6 +10472,7 @@ class Renderable2 extends BaseRenderable2 {
10486
10472
  if (this.buffered) {
10487
10473
  this.createFrameBuffer();
10488
10474
  }
10475
+ this.animationFps = options.animationFps;
10489
10476
  } catch (error) {
10490
10477
  try {
10491
10478
  this.destroyLayoutBacking();
@@ -10498,6 +10485,7 @@ class Renderable2 extends BaseRenderable2 {
10498
10485
  try {
10499
10486
  this.destroyLayoutBacking((run) => {
10500
10487
  this._isDestroyed = true;
10488
+ this.updateAnimationTick();
10501
10489
  Renderable2.renderablesByNumber.delete(this.num);
10502
10490
  if (cleanup)
10503
10491
  run(() => cleanup(run));
@@ -10586,6 +10574,7 @@ class Renderable2 extends BaseRenderable2 {
10586
10574
  this.propagateLiveCount(-1);
10587
10575
  }
10588
10576
  }
10577
+ this.updateAnimationTick();
10589
10578
  if (this._focused) {
10590
10579
  this.blur();
10591
10580
  }
@@ -10653,19 +10642,9 @@ class Renderable2 extends BaseRenderable2 {
10653
10642
  run(() => this.emit("focused" /* FOCUSED */));
10654
10643
  });
10655
10644
  }
10656
- propagateFocusChange(hasFocus) {
10657
- let parent = this.parent;
10658
- while (parent) {
10659
- if (!hasFocus) {
10660
- hasFocus = parent._childrenInLayoutOrder.some((child) => !child._isDestroyed && (child._focused || child._hasFocusedDescendant));
10661
- }
10662
- if (parent._hasFocusedDescendant !== hasFocus) {
10663
- parent._hasFocusedDescendant = hasFocus;
10664
- parent.markDirty();
10665
- }
10666
- hasFocus ||= parent._focused;
10667
- parent = parent.parent;
10668
- }
10645
+ propagateFocusChange(_hasFocus) {
10646
+ for (let parent = this.parent;parent; parent = parent.parent)
10647
+ parent.markDirty();
10669
10648
  this.requestRender();
10670
10649
  }
10671
10650
  blur() {
@@ -10693,7 +10672,13 @@ class Renderable2 extends BaseRenderable2 {
10693
10672
  return this._focused;
10694
10673
  }
10695
10674
  get hasFocusedDescendant() {
10696
- return this._hasFocusedDescendant;
10675
+ const focused = this._ctx.currentFocusedRenderable;
10676
+ if (!focused?._focused || focused._isDestroyed)
10677
+ return false;
10678
+ for (let parent = focused.parent;parent; parent = parent.parent)
10679
+ if (parent === this)
10680
+ return true;
10681
+ return false;
10697
10682
  }
10698
10683
  get live() {
10699
10684
  return this._live;
@@ -10716,6 +10701,37 @@ class Renderable2 extends BaseRenderable2 {
10716
10701
  this.parent?.propagateLiveCount(delta);
10717
10702
  }
10718
10703
  onLiveCountChanged(previous) {}
10704
+ get animationFps() {
10705
+ return this._animationFps;
10706
+ }
10707
+ set animationFps(value) {
10708
+ value ??= undefined;
10709
+ if (value !== undefined && !(value > 0 && value < Infinity)) {
10710
+ throw new RangeError(`animationFps must be positive and finite, got ${value}`);
10711
+ }
10712
+ if (this._animationFps === value)
10713
+ return;
10714
+ const toggled = this._animationFps === undefined !== (value === undefined);
10715
+ this._animationFps = value;
10716
+ if (toggled)
10717
+ this.refreshNativeSceneHooks();
10718
+ this.updateAnimationTick();
10719
+ }
10720
+ updateAnimationTick() {
10721
+ this.stopAnimationTick?.();
10722
+ this.stopAnimationTick = undefined;
10723
+ if (this._animationFps === undefined || !this._visible || this._isDestroyed)
10724
+ return;
10725
+ this.stopAnimationTick = this._ctx.onAnimationTick(this._animationFps, (deltaTime, ticks, time) => {
10726
+ if (this.animationDrawnFrame < this._ctx.frameId - 1) {
10727
+ this.stopAnimationTick?.();
10728
+ this.stopAnimationTick = undefined;
10729
+ return;
10730
+ }
10731
+ this.onAnimationTick(deltaTime, ticks, time);
10732
+ });
10733
+ }
10734
+ onAnimationTick(deltaTime, ticks, time) {}
10719
10735
  findDescendantById(id) {
10720
10736
  for (const child of this._childrenInLayoutOrder) {
10721
10737
  if (child.id === id)
@@ -10769,6 +10785,12 @@ class Renderable2 extends BaseRenderable2 {
10769
10785
  get _screenY() {
10770
10786
  return this._paintLayout?.screenY ?? this.screenY;
10771
10787
  }
10788
+ _paintOrigin(buffer) {
10789
+ return buffer === this.frameBuffer ? [0, 0] : [Math.trunc(this._screenX), Math.trunc(this._screenY)];
10790
+ }
10791
+ _drawNativeBody(buffer) {
10792
+ this._ctx.nativeScene.drawBody(this, buffer, ...this._paintOrigin(buffer));
10793
+ }
10772
10794
  get _paintWidth() {
10773
10795
  return this._paintLayout?.width ?? this.width;
10774
10796
  }
@@ -10901,7 +10923,7 @@ class Renderable2 extends BaseRenderable2 {
10901
10923
  }
10902
10924
  }
10903
10925
  getChildrenSortedByPrimaryAxis() {
10904
- const axis = isRowFlexDirection(this.getFlexDirection()) ? "screenX" : "screenY";
10926
+ const axis = this.primaryAxis === "row" ? "screenX" : "screenY";
10905
10927
  if (this._childrenInLayoutOrder.length < 2)
10906
10928
  return [...this._childrenInLayoutOrder];
10907
10929
  const children = this._childrenInLayoutOrder.map((child) => ({ child, coordinate: child[axis] }));
@@ -11422,21 +11444,7 @@ class Renderable2 extends BaseRenderable2 {
11422
11444
  const index = anchorIndex - (previous === target && previousIndex !== -1 && previousIndex < anchorIndex ? 1 : 0);
11423
11445
  let counts;
11424
11446
  let lifecycle;
11425
- let focus;
11426
- let focusPaths;
11427
11447
  if (previous !== target) {
11428
- if (child._focused || child._hasFocusedDescendant) {
11429
- focus = new Map;
11430
- focusPaths = [];
11431
- for (const start of [previous, target]) {
11432
- const path = [];
11433
- for (let parent = start;parent; parent = parent.parent) {
11434
- focus.set(parent, parent._hasFocusedDescendant);
11435
- path.push(parent);
11436
- }
11437
- focusPaths.push(path);
11438
- }
11439
- }
11440
11448
  if (child._liveCount > 0) {
11441
11449
  counts = new Map;
11442
11450
  for (const [start, delta] of [
@@ -11468,12 +11476,6 @@ class Renderable2 extends BaseRenderable2 {
11468
11476
  if (counts)
11469
11477
  for (const [parent, count] of counts)
11470
11478
  parent._liveCount = count.after;
11471
- if (focusPaths)
11472
- for (const path of focusPaths) {
11473
- for (const parent of path) {
11474
- parent._hasFocusedDescendant = parent._childrenInLayoutOrder.some((node) => node._focused || node._hasFocusedDescendant);
11475
- }
11476
- }
11477
11479
  if (lifecycle)
11478
11480
  for (const [passes, active] of lifecycle) {
11479
11481
  if (active)
@@ -11482,11 +11484,10 @@ class Renderable2 extends BaseRenderable2 {
11482
11484
  passes.delete(child);
11483
11485
  }
11484
11486
  this.runCleanup((run) => {
11485
- if (focus)
11486
- for (const [parent, focused] of focus) {
11487
- if (parent._hasFocusedDescendant !== focused)
11487
+ if (previous !== target && (child._focused || child.hasFocusedDescendant))
11488
+ for (const start of [previous, target])
11489
+ for (let parent = start;parent; parent = parent.parent)
11488
11490
  parent.markDirty();
11489
- }
11490
11491
  if (counts)
11491
11492
  for (const [parent, count] of counts)
11492
11493
  run(() => parent.onLiveCountChanged(count.before));
@@ -11594,7 +11595,7 @@ class Renderable2 extends BaseRenderable2 {
11594
11595
  this._ctx.nativeScene.moveNode(renderable, null, 0);
11595
11596
  this.removeLayoutChildAt(index);
11596
11597
  this.runCleanup((run) => {
11597
- if (renderable._focused || renderable._hasFocusedDescendant) {
11598
+ if (renderable._focused || renderable.hasFocusedDescendant) {
11598
11599
  run(() => renderable.propagateFocusChange(false));
11599
11600
  }
11600
11601
  if (renderable._liveCount > 0)
@@ -11703,6 +11704,8 @@ class Renderable2 extends BaseRenderable2 {
11703
11704
  return onResize !== Renderable2.baseHooks.onResize && onResize !== resize?.native;
11704
11705
  }
11705
11706
  hostUpdateFlags(onUpdate) {
11707
+ if (this._animationFps !== undefined)
11708
+ return NativeSceneHook2.Update;
11706
11709
  const update = this.nativeIntegration.lifecycle?.update;
11707
11710
  if (update && onUpdate === update.idle) {
11708
11711
  return update.active(this) ? NativeSceneHook2.Update : NativeSceneHook2.IdleUpdate;
@@ -11719,7 +11722,7 @@ class Renderable2 extends BaseRenderable2 {
11719
11722
  const resize = this.buffered || hooks.onLayoutResize !== Renderable2.baseHooks.onLayoutResize || this.needsHostResize(hooks.onResize);
11720
11723
  const sizeChange = "sizeChange" in pending ? pending.sizeChange : this._sizeChangeListener;
11721
11724
  const lineInfo = pending.lineInfo ?? (!!integration.lineInfo && this.listenerCount("line-info-change") > 0);
11722
- const flags = (hooks.renderBefore ? NativeSceneHook2.RenderBefore : 0) | (hooks.renderAfter ? NativeSceneHook2.RenderAfter : 0) | (this.usesNativeDrawing(hooks.renderSelf) ? 0 : NativeSceneHook2.RenderSelf) | this.hostUpdateFlags(hooks.onUpdate) | (resize || sizeChange || (pending.resize ?? this.listenerCount("resize")) > 0 ? NativeSceneHook2.Resize : 0) | ((pending.layout ?? this.listenerCount("layout-changed" /* LAYOUT_CHANGED */)) > 0 ? NativeSceneHook2.LayoutChanged : 0);
11725
+ const flags = (hooks.renderBefore ? NativeSceneHook2.RenderBefore : 0) | (hooks.renderAfter ? NativeSceneHook2.RenderAfter : 0) | (this.usesNativeDrawing(hooks.renderSelf) ? 0 : NativeSceneHook2.RenderSelf) | this.hostUpdateFlags(hooks.onUpdate) | (integration.lifecycle?.scroll?.active(this) ? NativeSceneHook2.Scroll : 0) | (resize || sizeChange || (pending.resize ?? this.listenerCount("resize")) > 0 ? NativeSceneHook2.Resize : 0) | ((pending.layout ?? this.listenerCount("layout-changed" /* LAYOUT_CHANGED */)) > 0 ? NativeSceneHook2.LayoutChanged : 0);
11723
11726
  const generation = this._nativeSceneHookGeneration + 1n;
11724
11727
  if (flags !== 0 || lineInfo || this._nativeSceneHooksRegistered) {
11725
11728
  let nativeFlags = flags;
@@ -11747,6 +11750,11 @@ class Renderable2 extends BaseRenderable2 {
11747
11750
  try {
11748
11751
  switch (request.kind) {
11749
11752
  case NativeSceneFrame2.Update:
11753
+ if (this._animationFps !== undefined) {
11754
+ this.animationDrawnFrame = this._ctx.frameId;
11755
+ if (!this.stopAnimationTick)
11756
+ this.updateAnimationTick();
11757
+ }
11750
11758
  this._hooks.onUpdate.call(this, deltaTime);
11751
11759
  break;
11752
11760
  case NativeSceneFrame2.Resize:
@@ -11766,6 +11774,9 @@ class Renderable2 extends BaseRenderable2 {
11766
11774
  case NativeSceneFrame2.LayoutChanged:
11767
11775
  this.emit("layout-changed" /* LAYOUT_CHANGED */);
11768
11776
  break;
11777
+ case NativeSceneFrame2.Scroll:
11778
+ this.nativeIntegration.lifecycle?.scroll?.notify(this);
11779
+ break;
11769
11780
  }
11770
11781
  } finally {
11771
11782
  this._paintLayout = undefined;
@@ -11818,18 +11829,12 @@ class Renderable2 extends BaseRenderable2 {
11818
11829
  this.assertMutable();
11819
11830
  this.destroyLayoutBacking((run) => {
11820
11831
  run(() => this.destroyOwnedResources());
11832
+ const heldFocus = this._focused || this.hasFocusedDescendant;
11821
11833
  this._isDestroyed = true;
11834
+ this.updateAnimationTick();
11822
11835
  run(() => this.emit("destroyed" /* DESTROYED */));
11823
- if (this._focused || this._hasFocusedDescendant) {
11824
- run(() => {
11825
- const current = this._ctx.currentFocusedRenderable;
11826
- let focused = current;
11827
- while (focused && focused !== this)
11828
- focused = focused.parent;
11829
- if (!current || focused === this)
11830
- this.propagateFocusChange(false);
11831
- });
11832
- }
11836
+ if (heldFocus)
11837
+ run(() => this.propagateFocusChange(false));
11833
11838
  if (this.parent) {
11834
11839
  const parent = this.parent;
11835
11840
  run(() => parent.remove(this));
@@ -12984,6 +12989,12 @@ class EditBuffer2 extends EventEmitter5 {
12984
12989
  getEOL() {
12985
12990
  return this.position(3 /* Eol */);
12986
12991
  }
12992
+ _getEOF() {
12993
+ return this.position(7 /* End */);
12994
+ }
12995
+ _getPrevCharBoundary() {
12996
+ return this.position(8 /* PrevChar */);
12997
+ }
12987
12998
  offsetToPosition(offset) {
12988
12999
  const result = this.position(4 /* Offset */, offset);
12989
13000
  return result && { row: result.row, col: result.col };
@@ -13538,6 +13549,7 @@ class Timeline2 {
13538
13549
  isPlaying = false;
13539
13550
  isComplete = false;
13540
13551
  duration;
13552
+ _frameRate;
13541
13553
  loop;
13542
13554
  synced = false;
13543
13555
  autoplay;
@@ -13546,11 +13558,20 @@ class Timeline2 {
13546
13558
  stateChangeListeners = [];
13547
13559
  constructor(options = {}) {
13548
13560
  this.duration = options.duration || 1000;
13561
+ this.frameRate = options.frameRate;
13549
13562
  this.loop = options.loop === true;
13550
13563
  this.autoplay = options.autoplay !== false;
13551
13564
  this.onComplete = options.onComplete;
13552
13565
  this.onPause = options.onPause;
13553
13566
  }
13567
+ get frameRate() {
13568
+ return this._frameRate;
13569
+ }
13570
+ set frameRate(value) {
13571
+ if (value !== undefined && !(value > 0))
13572
+ throw new RangeError(`frameRate must be above 0, got ${value}`);
13573
+ this._frameRate = value;
13574
+ }
13554
13575
  addStateChangeListener(listener) {
13555
13576
  this.stateChangeListeners.push(listener);
13556
13577
  }
@@ -13716,9 +13737,12 @@ class TimelineEngine {
13716
13737
  timelines = new Set;
13717
13738
  renderer = null;
13718
13739
  frameCallback = async (deltaTime) => {
13719
- this.update(deltaTime);
13740
+ if (this.tickFps === 0)
13741
+ this.update(deltaTime);
13720
13742
  };
13721
13743
  isLive = false;
13744
+ tickFps = 0;
13745
+ stopTicks;
13722
13746
  defaults = {
13723
13747
  frameRate: 60
13724
13748
  };
@@ -13751,20 +13775,35 @@ class TimelineEngine {
13751
13775
  this.renderer.dropLive();
13752
13776
  this.isLive = false;
13753
13777
  }
13778
+ this.setTickFps(0);
13754
13779
  }
13755
13780
  this.renderer = null;
13756
13781
  }
13757
13782
  updateLiveState() {
13758
13783
  if (!this.renderer)
13759
13784
  return;
13760
- const hasRunningTimelines = Array.from(this.timelines).some((timeline) => !timeline.synced && timeline.isPlaying && !timeline.isComplete);
13761
- if (hasRunningTimelines && !this.isLive) {
13785
+ let fps = 0;
13786
+ for (const timeline of this.timelines) {
13787
+ if (timeline.synced || !timeline.isPlaying || timeline.isComplete)
13788
+ continue;
13789
+ fps = Math.max(fps, timeline.frameRate ?? this.defaults.frameRate);
13790
+ }
13791
+ const live = fps > 0 && fps >= this.renderer.targetFps;
13792
+ if (live && !this.isLive) {
13762
13793
  this.renderer.requestLive();
13763
13794
  this.isLive = true;
13764
- } else if (!hasRunningTimelines && this.isLive) {
13795
+ } else if (!live && this.isLive) {
13765
13796
  this.renderer.dropLive();
13766
13797
  this.isLive = false;
13767
13798
  }
13799
+ this.setTickFps(live ? 0 : fps);
13800
+ }
13801
+ setTickFps(fps) {
13802
+ if (fps === this.tickFps)
13803
+ return;
13804
+ this.stopTicks?.();
13805
+ this.stopTicks = fps > 0 ? this.renderer?.onAnimationTick(fps, (deltaTime) => this.update(deltaTime)) : undefined;
13806
+ this.tickFps = fps;
13768
13807
  }
13769
13808
  onTimelineStateChange = (timeline) => {
13770
13809
  this.updateLiveState();
@@ -14060,32 +14099,9 @@ class BoxRenderable2 extends Renderable2 {
14060
14099
  });
14061
14100
  }
14062
14101
  renderSelf(buffer) {
14063
- const hasBorder = this.borderSides.top || this.borderSides.right || this.borderSides.bottom || this.borderSides.left;
14064
- const hasVisibleFill = this.shouldFill && this._backgroundColor.a > 0;
14065
- if (!hasBorder && !hasVisibleFill) {
14102
+ if (borderMask(this.borderSides) === 0 && !(this._shouldFill && this._backgroundColor.a > 0))
14066
14103
  return;
14067
- }
14068
- const hasFocusWithin = this._focusable && (this._focused || this._hasFocusedDescendant);
14069
- const currentBorderColor = hasFocusWithin ? this._focusedBorderColor : this._borderColor;
14070
- const screenX = Math.trunc(this._screenX);
14071
- const screenY = Math.trunc(this._screenY);
14072
- buffer.drawBox({
14073
- x: screenX,
14074
- y: screenY,
14075
- width: this._paintWidth,
14076
- height: this._paintHeight,
14077
- borderStyle: this._borderStyle,
14078
- customBorderChars: this._customBorderChars,
14079
- border: this._border,
14080
- borderColor: currentBorderColor,
14081
- backgroundColor: this._backgroundColor,
14082
- shouldFill: this.shouldFill,
14083
- title: this._title,
14084
- titleColor: this._titleColor ?? currentBorderColor,
14085
- titleAlignment: this._titleAlignment,
14086
- bottomTitle: this._bottomTitle,
14087
- bottomTitleAlignment: this._bottomTitleAlignment
14088
- });
14104
+ this._drawNativeBody(buffer);
14089
14105
  }
14090
14106
  get shouldFill() {
14091
14107
  return this._shouldFill;
@@ -14603,7 +14619,7 @@ class TextBufferRenderable2 extends Renderable2 {
14603
14619
  if (this.isDestroyed)
14604
14620
  throw new Error("Cannot draw destroyed text");
14605
14621
  if (this.nativeTextScene) {
14606
- this.nativeTextScene.drawText(this, buffer, Math.trunc(x), Math.trunc(y));
14622
+ this.nativeTextScene.drawBody(this, buffer, Math.trunc(x), Math.trunc(y));
14607
14623
  return;
14608
14624
  }
14609
14625
  buffer.drawTextBuffer(this.textBufferView, Math.trunc(x), Math.trunc(y));
@@ -19728,6 +19744,34 @@ class NativeScene {
19728
19744
  const { renderLib: lib, context } = this.driver;
19729
19745
  lib.sceneSetImage(context, renderable._getSceneHandle(this), image?._getContextHandle(lib, context) ?? null, fit, protocol, buffer?._getSceneHandle(this) ?? null);
19730
19746
  }
19747
+ setScroll(renderable, options) {
19748
+ this.flushStaged();
19749
+ this.driver.renderLib.sceneSetScroll(this.driver.context, renderable._getSceneHandle(this), options);
19750
+ this.changeLayout();
19751
+ }
19752
+ setScrollArrow(renderable, axis, end, options) {
19753
+ this.flushStaged();
19754
+ this.driver.renderLib.sceneSetScrollArrow(this.driver.context, renderable._getSceneHandle(this), axis, end, options);
19755
+ }
19756
+ scrollTo(renderable, x, y, relativeX, relativeY, reapply = false) {
19757
+ this.flushStaged();
19758
+ const handle = renderable._getSceneHandle(this);
19759
+ const state = this.driver.renderLib.sceneScrollTo(this.driver.context, handle, x, y, relativeX, relativeY, reapply);
19760
+ this.changeLayout();
19761
+ return state;
19762
+ }
19763
+ scrollRequest(renderable, kind, target, align, inset) {
19764
+ this.flushStaged();
19765
+ const { renderLib: lib, context } = this.driver;
19766
+ const handle = renderable._getSceneHandle(this);
19767
+ const state = lib.sceneScrollRequest(context, handle, kind, target?._getSceneHandle(this) ?? null, align, inset);
19768
+ this.changeLayout();
19769
+ return state;
19770
+ }
19771
+ getScroll(renderable) {
19772
+ this.flushStaged();
19773
+ return this.driver.renderLib.sceneGetScroll(this.driver.context, renderable._getSceneHandle(this));
19774
+ }
19731
19775
  setEditorView(renderable, view) {
19732
19776
  this.flushStaged();
19733
19777
  this.driver.renderLib.sceneSetEditorView(this.driver.context, renderable._getSceneHandle(this), view);
@@ -19752,9 +19796,9 @@ class NativeScene {
19752
19796
  this.flushStaged();
19753
19797
  return this.driver.renderLib.sceneGetText(this.driver.context, renderable._getSceneHandle(this));
19754
19798
  }
19755
- drawText(renderable, buffer, x, y) {
19799
+ drawBody(renderable, buffer, x, y) {
19756
19800
  this.flushStaged();
19757
- buffer._drawSceneText(this, renderable._getSceneHandle(this), x, y);
19801
+ buffer._drawSceneBody(this, renderable._getSceneHandle(this), x, y);
19758
19802
  }
19759
19803
  setTextSelection(renderable, operation, bounds, bg, fg) {
19760
19804
  this.flushStaged();
@@ -20105,9 +20149,6 @@ function isCapabilityResponse(sequence) {
20105
20149
  if (/\x1b\[\?\d+(?:;\d+)*\$y/.test(sequence)) {
20106
20150
  return true;
20107
20151
  }
20108
- if (/\x1b\[1;(?!1R)\d+R/.test(sequence)) {
20109
- return true;
20110
- }
20111
20152
  if (/\x1bP>\|[\s\S]*?\x1b\\/.test(sequence)) {
20112
20153
  return true;
20113
20154
  }
@@ -20134,6 +20175,9 @@ function isCapabilityResponse(sequence) {
20134
20175
  }
20135
20176
  return false;
20136
20177
  }
20178
+ function isExplicitWidthReport(sequence) {
20179
+ return /\x1b\[1;(?!1R)\d+R/.test(sequence);
20180
+ }
20137
20181
  function isPixelResolutionResponse(sequence) {
20138
20182
  return /\x1b\[4;\d+;\d+t/.test(sequence);
20139
20183
  }
@@ -20184,7 +20228,8 @@ var NO_EXPECTATIONS = {
20184
20228
  privateCapabilityRepliesActive: false,
20185
20229
  pixelResolutionQueryActive: false,
20186
20230
  explicitWidthCprActive: false,
20187
- startupCursorCprActive: false
20231
+ startupCursorCprActive: false,
20232
+ replySentinelActive: false
20188
20233
  };
20189
20234
  var REPLY_PROTOCOLS = {
20190
20235
  [C.OT_INPUT_REPLY_CSI]: "csi",
@@ -20214,7 +20259,7 @@ function latin1(bytes) {
20214
20259
  function expectationFlags(context) {
20215
20260
  const cursorPosition = context.explicitWidthCprActive || context.startupCursorCprActive;
20216
20261
  const replies = context.privateCapabilityRepliesActive || context.pixelResolutionQueryActive || cursorPosition;
20217
- return (replies ? C.OT_INPUT_EXPECT_REPLIES : 0) | (context.kittyKeyboardEnabled ? C.OT_INPUT_EXPECT_KITTY_KEYBOARD : 0) | (cursorPosition ? C.OT_INPUT_EXPECT_CURSOR_POSITION : 0);
20262
+ return (replies ? C.OT_INPUT_EXPECT_REPLIES : 0) | (context.kittyKeyboardEnabled ? C.OT_INPUT_EXPECT_KITTY_KEYBOARD : 0) | (cursorPosition ? C.OT_INPUT_EXPECT_CURSOR_POSITION : 0) | (context.replySentinelActive ? C.OT_INPUT_EXPECT_SENTINEL : 0);
20218
20263
  }
20219
20264
 
20220
20265
  class NativeStdinParser {
@@ -20277,6 +20322,9 @@ class NativeStdinParser {
20277
20322
  });
20278
20323
  this.reconcileTimeout(this.events.length > 0);
20279
20324
  }
20325
+ get pasting() {
20326
+ return this.paste !== null;
20327
+ }
20280
20328
  push(data) {
20281
20329
  this.ensureAlive();
20282
20330
  this.native(() => this.feed(data, this.nowNs()));
@@ -20662,9 +20710,6 @@ class RendererThemeMode {
20662
20710
  clock;
20663
20711
  static QUERY_TIMEOUT_MS = 250;
20664
20712
  _themeMode = null;
20665
- themeQueryPending = true;
20666
- themeOscForeground = null;
20667
- themeOscBackground = null;
20668
20713
  themeRefreshTimeoutId = null;
20669
20714
  waiters = new Set;
20670
20715
  constructor(host, clock) {
@@ -20693,14 +20738,6 @@ class RendererThemeMode {
20693
20738
  this.waiters.add(waiter);
20694
20739
  });
20695
20740
  }
20696
- cancelRefresh() {
20697
- if (this.themeRefreshTimeoutId === null) {
20698
- return;
20699
- }
20700
- this.clock.clearTimeout(this.themeRefreshTimeoutId);
20701
- this.themeRefreshTimeoutId = null;
20702
- this.themeQueryPending = false;
20703
- }
20704
20741
  dispose() {
20705
20742
  this.cancelRefresh();
20706
20743
  for (const waiter of this.waiters) {
@@ -20716,54 +20753,35 @@ class RendererThemeMode {
20716
20753
  this.requestThemeOscColors();
20717
20754
  return { handled: true, changedMode: null };
20718
20755
  }
20719
- let handledOscThemeResponse = false;
20756
+ let handled = false;
20757
+ let background = null;
20720
20758
  let match;
20721
20759
  OSC_THEME_RESPONSE.lastIndex = 0;
20722
20760
  while (match = OSC_THEME_RESPONSE.exec(sequence)) {
20723
- handledOscThemeResponse = true;
20724
- const color = oscThemeColorToHex(match[2], match[3], match[4], match[5]);
20725
- if (match[1] === "10") {
20726
- this.themeOscForeground = color;
20727
- } else {
20728
- this.themeOscBackground = color;
20729
- }
20730
- }
20731
- if (!handledOscThemeResponse) {
20732
- return { handled: false, changedMode: null };
20733
- }
20734
- if (!this.themeQueryPending) {
20735
- return { handled: true, changedMode: null };
20761
+ handled = true;
20762
+ if (match[1] === "11")
20763
+ background = oscThemeColorToHex(match[2], match[3], match[4], match[5]);
20736
20764
  }
20737
- if (!this.themeOscForeground || !this.themeOscBackground) {
20738
- return { handled: true, changedMode: null };
20765
+ if (background === null) {
20766
+ return { handled, changedMode: null };
20739
20767
  }
20740
- const nextMode = inferThemeModeFromBackgroundColor(this.themeOscBackground);
20741
- const changedMode = this.applyThemeMode(nextMode);
20742
- this.completeThemeQuery();
20743
- return { handled: true, changedMode };
20768
+ this.cancelRefresh();
20769
+ return { handled, changedMode: this.applyThemeMode(inferThemeModeFromBackgroundColor(background)) };
20744
20770
  }
20745
- clearThemeRefreshTimeout() {
20771
+ cancelRefresh() {
20746
20772
  if (this.themeRefreshTimeoutId === null) {
20747
20773
  return;
20748
20774
  }
20749
20775
  this.clock.clearTimeout(this.themeRefreshTimeoutId);
20750
20776
  this.themeRefreshTimeoutId = null;
20751
20777
  }
20752
- completeThemeQuery() {
20753
- this.clearThemeRefreshTimeout();
20754
- this.themeQueryPending = false;
20755
- }
20756
20778
  requestThemeOscColors() {
20757
20779
  if (this.themeRefreshTimeoutId !== null) {
20758
20780
  return;
20759
20781
  }
20760
- this.themeQueryPending = true;
20761
- this.themeOscForeground = null;
20762
- this.themeOscBackground = null;
20763
20782
  this.host.queryThemeColors();
20764
- this.clearThemeRefreshTimeout();
20765
20783
  this.themeRefreshTimeoutId = this.clock.setTimeout(() => {
20766
- this.completeThemeQuery();
20784
+ this.themeRefreshTimeoutId = null;
20767
20785
  }, RendererThemeMode.QUERY_TIMEOUT_MS);
20768
20786
  }
20769
20787
  applyThemeMode(mode) {
@@ -20958,6 +20976,7 @@ class ExternalOutputQueue {
20958
20976
 
20959
20977
  class ScrollbackSnapshotRenderContext extends EventEmitter8 {
20960
20978
  nativeOwner;
20979
+ clock;
20961
20980
  width;
20962
20981
  height;
20963
20982
  terminalWidth;
@@ -20976,9 +20995,10 @@ class ScrollbackSnapshotRenderContext extends EventEmitter8 {
20976
20995
  isDestroyed = false;
20977
20996
  controlState = "idle" /* IDLE */;
20978
20997
  detachedSession;
20979
- constructor(width, height, widthMethod, terminalWidth, terminalHeight, resolution, capabilities, nativeOwner) {
20998
+ constructor(width, height, widthMethod, terminalWidth, terminalHeight, resolution, capabilities, nativeOwner, clock) {
20980
20999
  super();
20981
21000
  this.nativeOwner = nativeOwner;
21001
+ this.clock = clock;
20982
21002
  this.width = width;
20983
21003
  this.height = height;
20984
21004
  this.terminalWidth = terminalWidth;
@@ -21048,6 +21068,9 @@ class ScrollbackSnapshotRenderContext extends EventEmitter8 {
21048
21068
  setMousePointer(_shape) {}
21049
21069
  requestLive() {}
21050
21070
  dropLive() {}
21071
+ onAnimationTick() {
21072
+ return () => {};
21073
+ }
21051
21074
  getSelection() {
21052
21075
  return null;
21053
21076
  }
@@ -21121,6 +21144,9 @@ var KITTY_FLAG_ALL_KEYS_AS_ESCAPES = 8;
21121
21144
  var KITTY_FLAG_REPORT_TEXT = 16;
21122
21145
  var DEFAULT_STDIN_PARSER_MAX_BUFFER_BYTES = 64 * 1024 * 1024;
21123
21146
  var NATIVE_PALETTE_QUERY_SIZE = 16;
21147
+ var REPLY_BACKSTOP_MS = 5000;
21148
+ var PIXEL_QUERIES_MAX = 4;
21149
+ var DA1_REPLY = /^\x1b\[\?[\d;]*c$/;
21124
21150
  function buildKittyKeyboardFlags2(config) {
21125
21151
  if (!config) {
21126
21152
  return 0;
@@ -21244,6 +21270,7 @@ var RendererControlState2;
21244
21270
  RendererControlState["EXPLICIT_STOPPED"] = "explicit_stopped";
21245
21271
  })(RendererControlState2 ||= {});
21246
21272
  var CLICK_REPEAT_INTERVAL_MS = 500;
21273
+ var ANIMATION_TIMER_SLACK_MS = 1;
21247
21274
 
21248
21275
  class CliRenderer2 extends EventEmitter8 {
21249
21276
  static animationFrameId = 0;
@@ -21262,6 +21289,7 @@ class CliRenderer2 extends EventEmitter8 {
21262
21289
  nativeResizeWait = null;
21263
21290
  nativeKittyKeyboardFlags = 0;
21264
21291
  kittyTransportMode = "raw";
21292
+ synchronizedOutput;
21265
21293
  kittyTransportTimer = null;
21266
21294
  _lastSceneTimeMs = 0;
21267
21295
  get lastSceneTimeMs() {
@@ -21304,6 +21332,9 @@ class CliRenderer2 extends EventEmitter8 {
21304
21332
  backgroundColor = RGBA2.fromInts(0, 0, 0, 0);
21305
21333
  waitingForPixelResolution = false;
21306
21334
  pixelResolutionRequeryPending = false;
21335
+ unansweredPixelQueries = 0;
21336
+ replyBatches = [];
21337
+ replySentinel = false;
21307
21338
  clock;
21308
21339
  rendering = false;
21309
21340
  renderingCompletion = null;
@@ -21317,6 +21348,8 @@ class CliRenderer2 extends EventEmitter8 {
21317
21348
  minTargetFrameTime = 1000 / this._maxFps;
21318
21349
  immediateRerenderRequested = false;
21319
21350
  liveRequestCounter = 0;
21351
+ animationTickers = new Set;
21352
+ animationTimer = null;
21320
21353
  _controlState = "idle" /* IDLE */;
21321
21354
  frameCallbacks = [];
21322
21355
  renderStats = {
@@ -21341,7 +21374,6 @@ class CliRenderer2 extends EventEmitter8 {
21341
21374
  cancelReadyFrame = null;
21342
21375
  resizeTimeoutId = null;
21343
21376
  pendingResizeSawDifferentSize = false;
21344
- capabilityTimeoutId = null;
21345
21377
  terminalKeepAliveTimer = null;
21346
21378
  xtVersionWaiters = new Set;
21347
21379
  splitStartupSeedTimeoutId = null;
@@ -21499,6 +21531,7 @@ Captured external output:
21499
21531
  throw new Error("nativeSceneWorkBudget was removed: frames always paint synchronously");
21500
21532
  }
21501
21533
  this.kittyTransportMode = config.kittyImageTransport ?? "raw";
21534
+ this.synchronizedOutput = config.synchronizedOutput;
21502
21535
  const transportCode = KITTY_IMAGE_TRANSPORTS.indexOf(this.kittyTransportMode);
21503
21536
  if (transportCode < 0)
21504
21537
  throw new TypeError("Invalid kittyImageTransport");
@@ -21672,6 +21705,7 @@ Captured external output:
21672
21705
  };
21673
21706
  const nativeInput = config.experimental_nativeInput ?? env2.OTUI_NATIVE_INPUT_PARSER;
21674
21707
  this.stdinParser = createStdinParser(nativeInput, () => this.drainStdinParser());
21708
+ this.replySentinel = this.stdinParser instanceof NativeStdinParser;
21675
21709
  if (env2.OTUI_NATIVE_INPUT_SHADOW) {
21676
21710
  this.stdinShadow = {
21677
21711
  parser: createStdinParser(!nativeInput, () => this.drainStdinShadow()),
@@ -22189,7 +22223,7 @@ Captured external output:
22189
22223
  const startOnNewLine = options.startOnNewLine ?? true;
22190
22224
  const tailColumn = renderer.getPendingSplitTailColumn();
22191
22225
  const firstLineOffset = !startOnNewLine && tailColumn > 0 && tailColumn < renderer.width ? tailColumn : 0;
22192
- const snapshotContext = new ScrollbackSnapshotRenderContext(renderer.width, 1, renderer.widthMethod, renderer._terminalWidth, renderer._terminalHeight, renderer.resolution, renderer.capabilities, renderer.nativeSession);
22226
+ const snapshotContext = new ScrollbackSnapshotRenderContext(renderer.width, 1, renderer.widthMethod, renderer._terminalWidth, renderer._terminalHeight, renderer.resolution, renderer.capabilities, renderer.nativeSession, renderer.clock);
22193
22227
  let firstLineOffsetOwner = null;
22194
22228
  const renderContext = Object.create(snapshotContext);
22195
22229
  Object.defineProperty(renderContext, "claimFirstLineOffset", {
@@ -22451,7 +22485,7 @@ Captured external output:
22451
22485
  if (this.screenMode !== "split-footer" || this.externalOutputMode !== "capture-stdout") {
22452
22486
  throw new Error('writeToScrollback requires screenMode "split-footer" and externalOutputMode "capture-stdout"');
22453
22487
  }
22454
- const snapshotContext = new ScrollbackSnapshotRenderContext(this.width, this.height, this.widthMethod, this._terminalWidth, this._terminalHeight, this.resolution, this.capabilities, this.nativeSession);
22488
+ const snapshotContext = new ScrollbackSnapshotRenderContext(this.width, this.height, this.widthMethod, this._terminalWidth, this._terminalHeight, this.resolution, this.capabilities, this.nativeSession, this.clock);
22455
22489
  let snapshot;
22456
22490
  let renderFailed = false;
22457
22491
  let snapshotRoot = null;
@@ -22661,7 +22695,7 @@ Captured external output:
22661
22695
  if (rows.length === 0) {
22662
22696
  return [];
22663
22697
  }
22664
- const snapshotContext = new ScrollbackSnapshotRenderContext(this.width, 1, this.widthMethod, this._terminalWidth, this._terminalHeight, this.resolution, this.capabilities, this.nativeSession);
22698
+ const snapshotContext = new ScrollbackSnapshotRenderContext(this.width, 1, this.widthMethod, this._terminalWidth, this._terminalHeight, this.resolution, this.capabilities, this.nativeSession, this.clock);
22665
22699
  const commits = [];
22666
22700
  let snapshotRoot;
22667
22701
  try {
@@ -22999,18 +23033,18 @@ Captured external output:
22999
23033
  return this.nativeTerminalTransition;
23000
23034
  const startupCursorCprActive = this._screenMode === "split-footer" && this._externalOutputMode === "capture-stdout";
23001
23035
  this.pendingSplitStartupCursorSeed = startupCursorCprActive;
23002
- this.updateStdinParserProtocolContext({
23003
- privateCapabilityRepliesActive: true,
23004
- explicitWidthCprActive: true,
23005
- startupCursorCprActive
23006
- });
23036
+ this.updateStdinParserProtocolContext({ startupCursorCprActive });
23037
+ const startup = this.admitReplyBatch("startup");
23007
23038
  try {
23008
23039
  await this.trackNativeTerminalTransition(this.nativeSession.setupTerminal({
23009
23040
  useAlternateScreen: this._screenMode === "alternate-screen",
23010
23041
  mouse: this._useMouse,
23011
23042
  mouseMovement: this.enableMouseMovement,
23012
23043
  kittyKeyboardFlags: this.nativeKittyKeyboardFlags,
23013
- clearOnClose: this.clearOnShutdown
23044
+ clearOnClose: this.clearOnShutdown,
23045
+ replySentinel: this.replySentinel,
23046
+ synchronizedOutput: this.synchronizedOutput,
23047
+ hostMultiplexer: this._usesProcessStdout && !!(process.env.TMUX || process.env.STY || process.env.ZELLIJ)
23014
23048
  }), () => {
23015
23049
  if (this._isDestroyed)
23016
23050
  return;
@@ -23021,7 +23055,7 @@ Captured external output:
23021
23055
  });
23022
23056
  } catch (error) {
23023
23057
  this.abortSplitStartupCursorSeed();
23024
- this.updateStdinParserProtocolContext({ privateCapabilityRepliesActive: false, explicitWidthCprActive: false });
23058
+ this.endReplyBatch(startup);
23025
23059
  throw error;
23026
23060
  }
23027
23061
  if (this._isDestroyed)
@@ -23034,20 +23068,7 @@ Captured external output:
23034
23068
  this.automaticMemorySnapshot = true;
23035
23069
  }
23036
23070
  }
23037
- this.capabilityTimeoutId = this.clock.setTimeout(() => {
23038
- this.capabilityTimeoutId = null;
23039
- this.clearSplitStartupCursorSeed();
23040
- if (this._screenMode === "split-footer" && this._externalOutputMode === "capture-stdout") {
23041
- this.requestRender();
23042
- }
23043
- this.removeInputHandler(this.capabilityHandler);
23044
- this.updateStdinParserProtocolContext({
23045
- privateCapabilityRepliesActive: false,
23046
- explicitWidthCprActive: false,
23047
- startupCursorCprActive: false
23048
- }, true);
23049
- this.resolveXtVersionWaiters();
23050
- }, 5000);
23071
+ this.armReplyBackstop(startup);
23051
23072
  if (this.pendingSplitStartupCursorSeed) {
23052
23073
  if (this.splitStartupSeedTimeoutId !== null) {
23053
23074
  this.clock.clearTimeout(this.splitStartupSeedTimeoutId);
@@ -23070,6 +23091,54 @@ Captured external output:
23070
23091
  this.refreshPalette();
23071
23092
  }
23072
23093
  }
23094
+ get startupRepliesPending() {
23095
+ return this.replyBatches.some((batch) => batch.kind === "startup");
23096
+ }
23097
+ admitReplyBatch(kind) {
23098
+ const batch = { kind, backstop: null, excused: this.replyBatches.some((earlier) => earlier.excused) };
23099
+ this.replyBatches.push(batch);
23100
+ this.syncReplyContext(false);
23101
+ return batch;
23102
+ }
23103
+ armReplyBackstop(batch) {
23104
+ if (!this.replyBatches.includes(batch) || batch.backstop !== null)
23105
+ return;
23106
+ if (this._controlState === "explicit_suspended" /* EXPLICIT_SUSPENDED */)
23107
+ return;
23108
+ batch.backstop = this.clock.setTimeout(() => {
23109
+ batch.backstop = null;
23110
+ const pasting = this.stdinParser instanceof NativeStdinParser && this.stdinParser.pasting;
23111
+ this.replySentinel &&= batch.excused || pasting;
23112
+ this.endReplyBatch(batch);
23113
+ }, REPLY_BACKSTOP_MS);
23114
+ }
23115
+ endReplyBatch(batch) {
23116
+ const index = this.replyBatches.indexOf(batch);
23117
+ if (index < 0)
23118
+ return;
23119
+ this.replyBatches.splice(index, 1);
23120
+ if (batch.backstop !== null)
23121
+ this.clock.clearTimeout(batch.backstop);
23122
+ if (batch.kind === "startup") {
23123
+ this.clearSplitStartupCursorSeed();
23124
+ if (this._screenMode === "split-footer" && this._externalOutputMode === "capture-stdout")
23125
+ this.requestRender();
23126
+ this.resolveXtVersionWaiters();
23127
+ } else if (!this.replyBatches.some((other) => other.kind === "pixel")) {
23128
+ this.waitingForPixelResolution = false;
23129
+ }
23130
+ this.syncReplyContext(true);
23131
+ }
23132
+ syncReplyContext(drain) {
23133
+ const startup = this.startupRepliesPending;
23134
+ this.updateStdinParserProtocolContext({
23135
+ privateCapabilityRepliesActive: startup,
23136
+ explicitWidthCprActive: startup,
23137
+ ...startup ? {} : { startupCursorCprActive: false },
23138
+ pixelResolutionQueryActive: this.waitingForPixelResolution,
23139
+ replySentinelActive: this.replySentinel && this.replyBatches.length > 0
23140
+ }, drain);
23141
+ }
23073
23142
  trackNativeTerminalTransition(transition, complete) {
23074
23143
  const tracked = transition.then(() => complete?.()).finally(() => {
23075
23144
  if (this.nativeTerminalTransition === tracked)
@@ -23134,8 +23203,8 @@ Captured external output:
23134
23203
  };
23135
23204
  }
23136
23205
  processCapabilitySequence(sequence, hasCursorReport) {
23137
- const hasStandardCapabilitySignature = isCapabilityResponse(sequence);
23138
- const shouldProcessAsCapability = hasStandardCapabilitySignature || hasCursorReport && (this.capabilityTimeoutId !== null || this.nativeTerminalTransition !== null);
23206
+ const hasStandardCapabilitySignature = isCapabilityResponse(sequence) || hasCursorReport && isExplicitWidthReport(sequence);
23207
+ const shouldProcessAsCapability = hasStandardCapabilitySignature || hasCursorReport && (this.startupRepliesPending || this.nativeTerminalTransition !== null);
23139
23208
  if (!shouldProcessAsCapability) {
23140
23209
  return false;
23141
23210
  }
@@ -23146,15 +23215,16 @@ Captured external output:
23146
23215
  throw error;
23147
23216
  return error.status !== -19 /* InvalidPhase */;
23148
23217
  }
23218
+ const previous = JSON.stringify(this._capabilities);
23149
23219
  this._capabilities = this.nativeSession.getCapabilities();
23150
23220
  if (this._capabilities?.terminal?.from_xtversion) {
23151
23221
  this.resolveXtVersionWaiters();
23152
23222
  }
23153
- if (hasStandardCapabilitySignature) {
23223
+ if (JSON.stringify(this._capabilities) !== previous) {
23154
23224
  this.forceFullRepaintRequested = true;
23155
23225
  this.requestRender();
23226
+ this.emit("capabilities" /* CAPABILITIES */, this._capabilities);
23156
23227
  }
23157
- this.emit("capabilities" /* CAPABILITIES */, this._capabilities);
23158
23228
  const hadPendingSplitStartupCursorSeed = this.pendingSplitStartupCursorSeed;
23159
23229
  if (hadPendingSplitStartupCursorSeed && hasCursorReport && this._screenMode === "split-footer" && this._externalOutputMode === "capture-stdout") {
23160
23230
  this.resetSplitScrollback(this.getSplitCursorSeedRows());
@@ -23232,6 +23302,13 @@ Captured external output:
23232
23302
  }
23233
23303
  }
23234
23304
  }
23305
+ if (event.type === "response" && this.replySentinel && this.replyBatches.length > 0 && DA1_REPLY.test(event.sequence)) {
23306
+ const batch = this.replyBatches[0];
23307
+ this.endReplyBatch(batch);
23308
+ if (batch.kind === "startup")
23309
+ this.processCapabilitySequence(event.sequence, false);
23310
+ return;
23311
+ }
23235
23312
  if (this._controlState === "explicit_suspended" /* EXPLICIT_SUSPENDED */) {
23236
23313
  if (event.type === "response" && isPixelResolutionResponse(event.sequence)) {
23237
23314
  this.dispatchSequenceHandlers(event.sequence);
@@ -23252,6 +23329,8 @@ Captured external output:
23252
23329
  this.dispatchSequenceHandlers(event.raw);
23253
23330
  return;
23254
23331
  case "paste":
23332
+ for (const batch of this.replyBatches)
23333
+ batch.excused = true;
23255
23334
  this._keyHandler.processPaste(event.bytes, event.metadata);
23256
23335
  return;
23257
23336
  case "response":
@@ -23289,26 +23368,26 @@ Captured external output:
23289
23368
  this.addInputHandler(handler);
23290
23369
  }
23291
23370
  this.addInputHandler((sequence) => {
23292
- if (isPixelResolutionResponse(sequence) && this.waitingForPixelResolution) {
23293
- this.waitingForPixelResolution = false;
23294
- if (this.pixelResolutionRequeryPending) {
23295
- this.updateStdinParserProtocolContext({ pixelResolutionQueryActive: false });
23296
- this.queryPixelResolution();
23297
- return true;
23298
- }
23299
- try {
23300
- const resolution = parsePixelResolution(sequence);
23301
- if (resolution) {
23302
- this.lib.sessionSetImageResolution(this.nativeSession.context, this.nativeSession.session, this._terminalWidth, this._terminalHeight, resolution.width, resolution.height);
23303
- this._resolution = resolution;
23304
- this.requestRender();
23305
- }
23306
- } finally {
23307
- this.updateStdinParserProtocolContext({ pixelResolutionQueryActive: false }, true);
23308
- }
23371
+ if (!isPixelResolutionResponse(sequence) || this.unansweredPixelQueries === 0)
23372
+ return false;
23373
+ this.unansweredPixelQueries--;
23374
+ this.waitingForPixelResolution = false;
23375
+ if (this.pixelResolutionRequeryPending) {
23376
+ this.syncReplyContext(false);
23377
+ this.queryPixelResolution();
23309
23378
  return true;
23310
23379
  }
23311
- return false;
23380
+ try {
23381
+ const resolution = parsePixelResolution(sequence);
23382
+ if (resolution) {
23383
+ this.lib.sessionSetImageResolution(this.nativeSession.context, this.nativeSession.session, this._terminalWidth, this._terminalHeight, resolution.width, resolution.height);
23384
+ this._resolution = resolution;
23385
+ this.requestRender();
23386
+ }
23387
+ } finally {
23388
+ this.syncReplyContext(true);
23389
+ }
23390
+ return true;
23312
23391
  });
23313
23392
  this.addInputHandler(this.capabilityHandler);
23314
23393
  this.addInputHandler(this.focusHandler);
@@ -23619,17 +23698,16 @@ Captured external output:
23619
23698
  pixelResolutionRetry = null;
23620
23699
  queryPixelResolution(retry = true) {
23621
23700
  this.pixelResolutionRequeryPending = true;
23622
- if (this._isDestroyed || !this._terminalIsSetup || this._controlState === "explicit_suspended" /* EXPLICIT_SUSPENDED */ || this.waitingForPixelResolution || this.pixelResolutionRetry)
23701
+ if (this._isDestroyed || !this._terminalIsSetup || this._controlState === "explicit_suspended" /* EXPLICIT_SUSPENDED */ || this.waitingForPixelResolution || this.unansweredPixelQueries >= PIXEL_QUERIES_MAX || this.pixelResolutionRetry)
23623
23702
  return;
23624
- this.pixelResolutionRequeryPending = false;
23625
- this.waitingForPixelResolution = true;
23626
- this.updateStdinParserProtocolContext({ pixelResolutionQueryActive: true });
23627
23703
  try {
23628
- this.nativeSession.control({ kind: "query-pixel-resolution" });
23704
+ this.nativeSession.control({ kind: "query-pixel-resolution", sentinel: this.replySentinel });
23705
+ this.pixelResolutionRequeryPending = false;
23706
+ this.waitingForPixelResolution = true;
23707
+ this.unansweredPixelQueries++;
23708
+ const batch = this.admitReplyBatch("pixel");
23709
+ this.nativeSession.idle().then(() => this.armReplyBackstop(batch), () => {});
23629
23710
  } catch (error) {
23630
- this.waitingForPixelResolution = false;
23631
- this.pixelResolutionRequeryPending = true;
23632
- this.updateStdinParserProtocolContext({ pixelResolutionQueryActive: false });
23633
23711
  if (!(error instanceof NativeError2))
23634
23712
  throw error;
23635
23713
  if (error.status === -19 /* InvalidPhase */)
@@ -23858,6 +23936,64 @@ Captured external output:
23858
23936
  if (this.animationRequest.delete(handle))
23859
23937
  this.dropLive();
23860
23938
  }
23939
+ onAnimationTick(fps, callback, options = {}) {
23940
+ const interval = 1000 / fps;
23941
+ const { tolerance } = options;
23942
+ if (!(interval > 0 && interval < Infinity))
23943
+ throw new RangeError(`fps must be positive and finite, got ${fps}`);
23944
+ if (tolerance !== undefined && !(tolerance >= 0 && tolerance < interval)) {
23945
+ throw new RangeError(`tolerance must be at least 0 and below the interval (${interval} ms), got ${tolerance}`);
23946
+ }
23947
+ if (this._isDestroyed)
23948
+ return () => {};
23949
+ const now = this.clock.now();
23950
+ const window = Math.max(tolerance === undefined ? 500 : tolerance * fps, ANIMATION_TIMER_SLACK_MS * fps);
23951
+ const ticker = { fps, window, next: Math.floor((now * fps + window) / 1000) + 1, last: now, callback };
23952
+ this.animationTickers.add(ticker);
23953
+ this.scheduleAnimationTick();
23954
+ return () => {
23955
+ if (this.animationTickers.delete(ticker))
23956
+ this.scheduleAnimationTick();
23957
+ };
23958
+ }
23959
+ scheduleAnimationTick() {
23960
+ if (this.animationTimer !== null)
23961
+ this.clock.clearTimeout(this.animationTimer);
23962
+ this.animationTimer = null;
23963
+ let fastest = 0;
23964
+ for (const ticker of this.animationTickers)
23965
+ fastest = Math.max(fastest, ticker.fps);
23966
+ let due = Infinity;
23967
+ for (const ticker of this.animationTickers) {
23968
+ const late = ticker.fps === fastest ? 0 : ticker.window;
23969
+ due = Math.min(due, (ticker.next * 1000 + late) / ticker.fps);
23970
+ }
23971
+ if (due === Infinity)
23972
+ return;
23973
+ this.animationTimer = this.clock.setTimeout(() => {
23974
+ this.animationTimer = null;
23975
+ this.requestRender();
23976
+ }, Math.max(0, due - this.clock.now()));
23977
+ }
23978
+ runAnimationTicks(time) {
23979
+ if (this.animationTickers.size === 0)
23980
+ return;
23981
+ for (const ticker of this.animationTickers) {
23982
+ const reach = Math.floor((time * ticker.fps + ticker.window) / 1000);
23983
+ if (reach < ticker.next)
23984
+ continue;
23985
+ const ticks = reach + 1 - ticker.next;
23986
+ const deltaTime = Math.max(0, time - ticker.last);
23987
+ ticker.next = reach + 1;
23988
+ ticker.last = time;
23989
+ try {
23990
+ ticker.callback(deltaTime, ticks, time);
23991
+ } catch (error) {
23992
+ console.error("Error in animation tick callback:", error);
23993
+ }
23994
+ }
23995
+ this.scheduleAnimationTick();
23996
+ }
23861
23997
  yieldFrame() {
23862
23998
  if (!this.canRender)
23863
23999
  return Promise.resolve();
@@ -23971,12 +24107,15 @@ Captured external output:
23971
24107
  this.clearSplitStartupCursorSeed();
23972
24108
  this.disableMouse();
23973
24109
  this.removeExitListeners();
23974
- this.updateStdinParserProtocolContext({
23975
- privateCapabilityRepliesActive: false,
23976
- pixelResolutionQueryActive: this.waitingForPixelResolution,
23977
- explicitWidthCprActive: false,
23978
- startupCursorCprActive: false
23979
- }, true);
24110
+ for (const batch of [...this.replyBatches]) {
24111
+ if (batch.backstop !== null)
24112
+ this.clock.clearTimeout(batch.backstop);
24113
+ batch.backstop = null;
24114
+ batch.excused = true;
24115
+ if (!this.replySentinel && batch.kind === "startup")
24116
+ this.endReplyBatch(batch);
24117
+ }
24118
+ this.updateStdinParserProtocolContext({ startupCursorCprActive: false }, true);
23980
24119
  this.pauseStdinParsers(false);
23981
24120
  this.stdin.removeListener("data", this.stdinListener);
23982
24121
  this.stopTerminalKeepAlive();
@@ -24031,6 +24170,11 @@ Captured external output:
24031
24170
  let drained;
24032
24171
  while ((drained = this.stdin.read()) !== null)
24033
24172
  this.stdinListener(drained);
24173
+ this.updateStdinParserProtocolContext({
24174
+ privateCapabilityRepliesActive: false,
24175
+ explicitWidthCprActive: false,
24176
+ replySentinelActive: false
24177
+ }, true);
24034
24178
  this.pauseStdinParsers(true);
24035
24179
  this.stdin.on("data", this.stdinListener);
24036
24180
  this.stdin.resume();
@@ -24043,6 +24187,9 @@ Captured external output:
24043
24187
  this.startKittyTransportPolling();
24044
24188
  this.nativeSession.startKittyFileProbe();
24045
24189
  this._controlState = this._previousControlState;
24190
+ for (const batch of this.replyBatches)
24191
+ this.armReplyBackstop(batch);
24192
+ this.syncReplyContext(false);
24046
24193
  if (this.pixelResolutionRequeryPending)
24047
24194
  this.queryPixelResolution();
24048
24195
  for (const parser of this.legacyStdinParsers())
@@ -24117,6 +24264,8 @@ Captured external output:
24117
24264
  this.animationRequest.clear();
24118
24265
  this.frameCallbacks = [];
24119
24266
  this.liveRequestCounter = 0;
24267
+ this.animationTickers.clear();
24268
+ this.scheduleAnimationTick();
24120
24269
  this.immediateRerenderRequested = false;
24121
24270
  if (this._usesProcessStdout) {
24122
24271
  this.removeCleanupListener(process, "SIGWINCH", this.sigwinchHandler);
@@ -24129,10 +24278,11 @@ Captured external output:
24129
24278
  this.clock.clearTimeout(this.resizeTimeoutId);
24130
24279
  this.resizeTimeoutId = null;
24131
24280
  }
24132
- if (this.capabilityTimeoutId !== null) {
24133
- this.clock.clearTimeout(this.capabilityTimeoutId);
24134
- this.capabilityTimeoutId = null;
24281
+ for (const batch of this.replyBatches) {
24282
+ if (batch.backstop !== null)
24283
+ this.clock.clearTimeout(batch.backstop);
24135
24284
  }
24285
+ this.replyBatches = [];
24136
24286
  this.clearSplitStartupCursorSeed();
24137
24287
  if (this.memorySnapshotTimer) {
24138
24288
  this.clock.clearInterval(this.memorySnapshotTimer);
@@ -24144,12 +24294,7 @@ Captured external output:
24144
24294
  this.waitingForPixelResolution = false;
24145
24295
  this.pixelResolutionRequeryPending = false;
24146
24296
  try {
24147
- this.updateStdinParserProtocolContext({
24148
- privateCapabilityRepliesActive: false,
24149
- pixelResolutionQueryActive: false,
24150
- explicitWidthCprActive: false,
24151
- startupCursorCprActive: false
24152
- }, true);
24297
+ this.syncReplyContext(true);
24153
24298
  } catch (error) {
24154
24299
  this.handleStdinParserFailure(error);
24155
24300
  }
@@ -24309,6 +24454,9 @@ Captured external output:
24309
24454
  this.lastTime = now;
24310
24455
  this.renderStats.frameCount++;
24311
24456
  const overallStart = performance.now();
24457
+ const requestedBeforeTicks = this.immediateRerenderRequested;
24458
+ this.runAnimationTicks(now);
24459
+ this.immediateRerenderRequested = requestedBeforeTicks;
24312
24460
  const animationFrameEnd = CliRenderer2.animationFrameId;
24313
24461
  const animationRequestStart = performance.now();
24314
24462
  for (const [id, callback] of this.animationRequest) {
@@ -24803,7 +24951,7 @@ Captured external output:
24803
24951
  }
24804
24952
  }
24805
24953
  waitForXtVersion() {
24806
- if (this.capabilityTimeoutId === null || this._capabilities?.terminal?.from_xtversion) {
24954
+ if (!this.startupRepliesPending || this._capabilities?.terminal?.from_xtversion) {
24807
24955
  return Promise.resolve();
24808
24956
  }
24809
24957
  return new Promise((resolve) => {
@@ -24943,5 +25091,5 @@ Captured external output:
24943
25091
 
24944
25092
  export { isValidBorderStyle2, parseBorderStyle2, BorderChars2, getBorderFromSides2, getBorderSides2, borderCharsToArray2, BorderCharArrays2, KeyEvent2, PasteEvent2, KeyHandler2, InternalKeyHandler2, fonts2, measureText2, getCharacterPositions2, coordinateToCharacterIndex2, renderFontToFrameBuffer2, hastToStyledText2, SystemClock2, nonAlphanumericKeys2, terminalNamedSingleStrokeKeys2, parseKeypress2, LinearScrollAccel2, MacOSScrollAccel2, parseAlign2, parseAlignItems2, parseBoxSizing2, parseDimension2, parseDirection2, parseDisplay2, parseEdge2, parseFlexDirection2, parseGutter2, parseJustify2, parseLogLevel2, parseMeasureMode2, parseOverflow2, parsePositionType2, parseUnit2, parseWrap2, MouseParser2, Selection2, convertGlobalToLocalSelection2, ASCIIFontSelectionHelper2, StdinParser2, addDefaultParsers2, TreeSitterClient2, treeSitterToTextChunks2, treeSitterToStyledText2, DataPathsManager2, getDataPaths2, extensionToFiletype2, basenameToFiletype2, extToFiletype2, pathToFiletype2, infoStringToFiletype2, getTreeSitterClient2, destroyTreeSitterClient2, ExtmarksController2, createExtmarksController2, TerminalPalette2, createTerminalPalette2, normalizeTerminalPalette2, buildTerminalPaletteSignature2, decodePasteBytes2, stripAnsiSequences2, createHostClipboard2, createClipboard2, ClipboardTarget2, createRendererClipboardAdapter2, normalizeMarkdownLinkTarget, detectLinks2, acquireSessionBufferLease2, ResourceContext2, OptimizedBuffer2, h2, isVNode2, maybeMakeRenderable2, wrapWithDelegates2, instantiate2, delegate2, LayoutEvents2, RenderableEvents2, isRenderable2, BaseRenderable2, Renderable2, RootRenderable2, TextBuffer2, TextBufferView2, EditBuffer2, measureEditText2, EditorView2, Timeline2, engine2, getTimelineEngine2, createTimeline2, ANSI, BoxRenderable2, wheelDirection, scrollOnce, TextBufferRenderable2, CodeRenderable2, ImageLoadError2, ImageError2, imageInfo2, NativeImage2, NativeImagePool2, resolveImageRenderProtocol2, ImageRenderable2, isTextNodeRenderable2, TextNodeRenderable2, RootTextNodeRenderable2, TextRenderable2, NativeSession2, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture2, ConsolePosition2, TerminalConsole2, EditBufferRenderableEvents2, isEditBufferRenderable2, EditBufferRenderable2, buildKittyKeyboardFlags2, MouseEvent2, MouseButton2, createCliRenderer2, CliRenderEvents2, RendererControlState2, CliRenderer2 };
24945
25093
 
24946
- //# debugId=37A13ADEE7EBAEBB64756E2164756E21
24947
- //# sourceMappingURL=chunk-node-7bcmqh18.js.map
25094
+ //# debugId=F010F97393855BC764756E2164756E21
25095
+ //# sourceMappingURL=chunk-node-q5ccgbk5.js.map