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