tmux-ide 2.9.26 → 2.9.28
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/README.md +1 -1
- package/bin/cli.js +2046 -623
- package/package.json +2 -2
- package/packages/contracts/src/pane-stream.ts +45 -0
- package/packages/contracts/src/terminal-delivery.ts +114 -3
- package/packages/core/src/index.ts +1 -0
- package/packages/core/src/terminal-delivery-binary.ts +8 -7
- package/packages/core/src/terminal-delivery.ts +174 -3
- package/packages/core/src/terminal-partial-history.ts +152 -0
- package/packages/core/src/terminal-replica.ts +70 -1
- package/packages/daemon/dist/command-center/owner-keep-alive.js +30 -0
- package/packages/daemon/dist/command-center/resources/terminal-runtime-inventory.js +17 -3
- package/packages/daemon/dist/command-center/server.js +3 -0
- package/packages/daemon/dist/command-center/tmux-server-attach.js +51 -0
- package/packages/daemon/dist/command-center/tmux-servers.js +80 -1
- package/packages/daemon/dist/doctor.js +4 -4
- package/packages/daemon/dist/lib/app-config.js +7 -0
- package/packages/daemon/dist/lib/node-requirement.js +20 -0
- package/packages/daemon/dist/lib/require-supported-node.js +8 -0
- package/packages/daemon/dist/lib/tmux-server-session-open.js +38 -12
- package/packages/daemon/dist/lib/workspace-promotion.js +4 -4
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Info.plist +2 -2
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/MacOS/tmux-ide-notifier +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Resources/Assets.car +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/_CodeSignature/CodeResources +2 -2
- package/packages/daemon/dist/server/pane-stream-upgrade.js +39 -1
- package/packages/daemon/dist/terminal/attachments/native-runtime.js +12 -8
- package/packages/daemon/dist/terminal/mirror/mirror-service.js +13 -0
- package/packages/daemon/dist/terminal/mirror/native-atomic-snapshot.js +17 -7
- package/packages/daemon/dist/terminal/mirror/native-grid-capture.js +129 -5
- package/packages/daemon/dist/terminal/mirror/pane-feed.js +4 -0
- package/packages/daemon/dist/terminal/mirror/pane-hold.js +13 -0
- package/packages/daemon/dist/terminal/mirror/session-channel.js +198 -27
- package/packages/daemon/dist/terminal/pane-stream/lease-manager.js +1 -0
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +198 -12
- package/packages/daemon/dist/terminal/protocol/layout-parse.js +99 -10
- package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.js +5 -2
- package/packages/daemon/dist/terminal/session-runtime/registry.js +1 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-hub.js +465 -42
- package/packages/daemon/dist/terminal/session-runtime/terminal-interpreter-backend.js +2 -1
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-interpreter.js +46 -1
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-owner.js +128 -3
- package/packages/daemon/dist/terminal/session-runtime/xterm-terminal-interpreter-backend.js +115 -6
- package/packages/daemon/dist/tui/mirror/open-tui-workspace-runtime-port.js +94 -2
- package/packages/daemon/dist/tui/mirror/runtime/open-tui-generation-host.js +9 -1
- package/packages/daemon/dist/tui/mirror/theme.js +8 -1
- package/packages/daemon/dist/tui/mirror/workspace/connection-feedback.js +8 -0
- package/packages/daemon/src/command-center/attach-window-rule.cases.json +84 -0
- package/packages/daemon/src/command-center/owner-keep-alive.ts +38 -0
- package/packages/daemon/src/command-center/resources/terminal-runtime-inventory.ts +20 -2
- package/packages/daemon/src/command-center/server.ts +3 -0
- package/packages/daemon/src/command-center/tmux-server-attach.ts +75 -0
- package/packages/daemon/src/command-center/tmux-servers.ts +88 -1
- package/packages/daemon/src/doctor.ts +4 -4
- package/packages/daemon/src/lib/app-config.ts +15 -0
- package/packages/daemon/src/lib/node-requirement.ts +22 -0
- package/packages/daemon/src/lib/require-supported-node.ts +9 -0
- package/packages/daemon/src/lib/tmux-server-session-open.ts +53 -15
- package/packages/daemon/src/lib/workspace-promotion.ts +4 -4
- package/packages/daemon/src/server/pane-stream-upgrade.ts +41 -1
- package/packages/daemon/src/terminal/attachments/native-runtime.ts +15 -1
- package/packages/daemon/src/terminal/mirror/events.ts +31 -1
- package/packages/daemon/src/terminal/mirror/mirror-service.ts +19 -0
- package/packages/daemon/src/terminal/mirror/native-atomic-snapshot.ts +16 -5
- package/packages/daemon/src/terminal/mirror/native-grid-capture.ts +164 -5
- package/packages/daemon/src/terminal/mirror/pane-feed.ts +5 -0
- package/packages/daemon/src/terminal/mirror/pane-hold.ts +16 -0
- package/packages/daemon/src/terminal/mirror/session-channel.ts +253 -38
- package/packages/daemon/src/terminal/mirror/trusted-inventory.ts +2 -0
- package/packages/daemon/src/terminal/pane-stream/lease-manager.ts +3 -0
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +240 -12
- package/packages/daemon/src/terminal/protocol/layout-parse.ts +109 -10
- package/packages/daemon/src/terminal/protocol/session-descriptor-discovery.ts +10 -1
- package/packages/daemon/src/terminal/session-runtime/registry.ts +1 -0
- package/packages/daemon/src/terminal/session-runtime/runtime-observability.ts +2 -1
- package/packages/daemon/src/terminal/session-runtime/terminal-delivery-hub.ts +575 -39
- package/packages/daemon/src/terminal/session-runtime/terminal-interpreter-backend.ts +24 -1
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-interpreter.ts +61 -5
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-owner.ts +159 -32
- package/packages/daemon/src/terminal/session-runtime/xterm-terminal-interpreter-backend.ts +134 -11
- package/packages/daemon/src/tui/mirror/open-tui-workspace-runtime-port.ts +101 -2
- package/packages/daemon/src/tui/mirror/runtime/open-tui-generation-host.ts +13 -0
- package/packages/daemon/src/tui/mirror/theme.ts +13 -1
- package/packages/daemon/src/tui/mirror/workspace/connection-feedback.ts +13 -1
- package/packages/daemon-client/src/direct-application-shell-transport.ts +6 -2
- package/packages/daemon-client/src/pane-stream-client.ts +24 -6
- package/packages/daemon-client/src/workspace-client-types.ts +6 -0
- package/packages/daemon-client/src/workspace-client.ts +15 -9
- package/packages/daemon-client/src/workspace-event-supervisor.ts +3 -1
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
TERMINAL_PROJECTION_LOCAL_CAPABILITY_VERSION,
|
|
18
18
|
type TerminalProjectionReceipt,
|
|
19
19
|
type TerminalProjectionMaterialize,
|
|
20
|
+
type TerminalDeliveryHistoryRequest,
|
|
20
21
|
} from "@tmux-ide/contracts";
|
|
21
22
|
import type { LocalImageOwner } from "../graphics/local-image-owner.ts";
|
|
22
23
|
import {
|
|
@@ -27,8 +28,12 @@ import {
|
|
|
27
28
|
PANE_STREAM_BROWSER_KIND_CAPABILITY_VERSION,
|
|
28
29
|
PANE_STREAM_READER_TOPOLOGY_BUNDLE_CAPABILITY_VERSION,
|
|
29
30
|
PANE_STREAM_TOPOLOGY_IN_PLACE_CAPABILITY_VERSION,
|
|
31
|
+
PANE_STREAM_PANE_HELD_CLOSE_CODE,
|
|
32
|
+
paneHeldCloseReason,
|
|
30
33
|
type PaneStreamInputLifetime,
|
|
34
|
+
type PaneStreamPaneHold,
|
|
31
35
|
} from "@tmux-ide/contracts";
|
|
36
|
+
import { MirrorPaneHeldError } from "../mirror/pane-hold.ts";
|
|
32
37
|
import { inflateSync } from "node:zlib";
|
|
33
38
|
import { PaneStreamLayoutSnapshotFrameSchemaZ, type WindowLinkTopology } from "@tmux-ide/contracts";
|
|
34
39
|
import type { TerminalDeliveryGraphics } from "../session-runtime/terminal-delivery-hub.ts";
|
|
@@ -204,6 +209,14 @@ function semanticBackendRefusal(error: unknown): string | null {
|
|
|
204
209
|
}
|
|
205
210
|
const TYPE_FIRST_INPUT_FRAME_PREFIX = Buffer.from('{"type":"input",', "utf8");
|
|
206
211
|
|
|
212
|
+
/**
|
|
213
|
+
* #882: the panes a stream can attach to and the layout covers. A floating
|
|
214
|
+
* pane is listed by the description but has no tiled cell, so it is left out.
|
|
215
|
+
*/
|
|
216
|
+
function tiledPanes(described: MirrorSessionDescription): MirrorSessionDescription["panes"] {
|
|
217
|
+
return described.panes.filter((pane) => pane.floating !== true);
|
|
218
|
+
}
|
|
219
|
+
|
|
207
220
|
function startsWithBuffer(raw: Buffer, prefix: Buffer): boolean {
|
|
208
221
|
return (
|
|
209
222
|
raw.length >= prefix.length && raw.compare(prefix, 0, prefix.length, 0, prefix.length) === 0
|
|
@@ -235,6 +248,8 @@ export interface PaneStreamMirror {
|
|
|
235
248
|
expectedSemanticPaneIds?: readonly string[],
|
|
236
249
|
): Promise<{ readonly description: MirrorSessionDescription; readonly runtimeSessionId: string }>;
|
|
237
250
|
subscribe(request: MirrorSubscribeRequest): Promise<MirrorSubscription>;
|
|
251
|
+
/** #872: a person's retry; the panes' next recoveries ask tmux even inside a hold. */
|
|
252
|
+
liftRecoveryHolds?(session: string, semanticPaneIds: readonly string[]): void;
|
|
238
253
|
subscribeLayout?(
|
|
239
254
|
session: string,
|
|
240
255
|
onLayout: (event: MirrorLayoutEvent) => void,
|
|
@@ -314,6 +329,12 @@ export type PaneStreamUpgradeDecision =
|
|
|
314
329
|
export interface PaneStreamPreAuthAdmission {
|
|
315
330
|
bind(socket: DirectTerminalSocket): void;
|
|
316
331
|
cancelBeforeBind(): void;
|
|
332
|
+
/**
|
|
333
|
+
* Redeem with the frame the upgrade request carried (attach-rtt), exactly
|
|
334
|
+
* as if it were the socket's first message. A frame sent afterwards is a
|
|
335
|
+
* second redemption and closes the socket.
|
|
336
|
+
*/
|
|
337
|
+
redeemFromUpgrade(frame: Buffer): void;
|
|
317
338
|
}
|
|
318
339
|
|
|
319
340
|
export interface PaneStreamAdmissionSnapshot {
|
|
@@ -343,6 +364,12 @@ export interface PaneStreamAdmissionCoordinatorOptions {
|
|
|
343
364
|
readonly drainTickMs?: number;
|
|
344
365
|
/** Waits between tries of a step of a stream's opening that failed (#585). */
|
|
345
366
|
readonly openRetryDelaysMs?: readonly number[];
|
|
367
|
+
/**
|
|
368
|
+
* Waits between later tries of a pane whose delivery still failed after the
|
|
369
|
+
* opening's tries, while the stream runs without it (#585). Empty: that
|
|
370
|
+
* pane's failure closes the stream at once.
|
|
371
|
+
*/
|
|
372
|
+
readonly deferredPaneRetryDelaysMs?: readonly number[];
|
|
346
373
|
/** How long input waits for registered-window ownership to be read again. */
|
|
347
374
|
readonly ownershipWaitMs?: number;
|
|
348
375
|
/** Hard whole-socket ceiling; the ledger should stall panes far earlier. */
|
|
@@ -422,6 +449,8 @@ export interface SessionRuntimeTerminalDeliveryConnection {
|
|
|
422
449
|
ack(ack: TerminalDeliveryAck): void;
|
|
423
450
|
projectionReceipt?(receipt: TerminalProjectionReceipt): void;
|
|
424
451
|
materialize?(request: TerminalProjectionMaterialize): void;
|
|
452
|
+
/** Capability 122: older history rows for a client holding a partial history. */
|
|
453
|
+
historyRequest?(request: TerminalDeliveryHistoryRequest): void;
|
|
425
454
|
nack(nack: TerminalDeliveryNack): void;
|
|
426
455
|
setVisibility(visibility: TerminalDeliveryVisibility): void;
|
|
427
456
|
/** The client typed into this pane: send its deliveries first. */
|
|
@@ -463,6 +492,36 @@ function sendControl(socket: DirectTerminalSocket, frame: Readonly<Record<string
|
|
|
463
492
|
socket.send(encoded, { binary: false });
|
|
464
493
|
}
|
|
465
494
|
|
|
495
|
+
/**
|
|
496
|
+
* The hold to close with when every pane that failed to open was held (#872):
|
|
497
|
+
* the longest wait, and too large if any held pane was. Null when any failure
|
|
498
|
+
* was something else.
|
|
499
|
+
*/
|
|
500
|
+
function heldOnly(
|
|
501
|
+
settled: readonly PromiseSettledResult<{
|
|
502
|
+
readonly delivery: { readonly negotiation: { readonly accepted: boolean } };
|
|
503
|
+
}>[],
|
|
504
|
+
): PaneStreamPaneHold | null {
|
|
505
|
+
let retryInMs = 0;
|
|
506
|
+
let tooLarge = false;
|
|
507
|
+
for (const result of settled) {
|
|
508
|
+
if (result.status === "fulfilled") {
|
|
509
|
+
if (!result.value.delivery.negotiation.accepted) return null;
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
const reason: unknown = result.reason;
|
|
513
|
+
if (!(reason instanceof MirrorPaneHeldError)) return null;
|
|
514
|
+
retryInMs = Math.max(retryInMs, reason.hold.retryInMs);
|
|
515
|
+
tooLarge ||= reason.hold.why === "too-large";
|
|
516
|
+
}
|
|
517
|
+
// Called only when a pane did not open, so at least one was held here.
|
|
518
|
+
return { retryInMs, why: tooLarge ? "too-large" : "failed" };
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
function errorText(error: unknown): string {
|
|
522
|
+
return (error instanceof Error ? error.message : String(error)).slice(0, 300);
|
|
523
|
+
}
|
|
524
|
+
|
|
466
525
|
function errorFrameCode(error: unknown): PaneStreamErrorFrameCode {
|
|
467
526
|
if (error instanceof PaneStreamLeaseError && error.code === "ticket-expired") {
|
|
468
527
|
return "ticket-expired";
|
|
@@ -502,6 +561,7 @@ export class PaneStreamAdmissionCoordinator {
|
|
|
502
561
|
readonly #flowBudgets: PaneStreamFlowBudgets;
|
|
503
562
|
readonly #drainTickMs: number;
|
|
504
563
|
readonly #openRetryDelaysMs: readonly number[];
|
|
564
|
+
readonly #deferredPaneRetryDelaysMs: readonly number[];
|
|
505
565
|
readonly #ownershipWaitMs: number;
|
|
506
566
|
readonly #maxSocketBufferedBytes: number;
|
|
507
567
|
readonly #maxInputFrames: number;
|
|
@@ -544,6 +604,8 @@ export class PaneStreamAdmissionCoordinator {
|
|
|
544
604
|
this.#ledger = new PaneStreamWireLedger(this.#flowBudgets);
|
|
545
605
|
this.#drainTickMs = boundedInteger(options.drainTickMs, 15, 1_000);
|
|
546
606
|
this.#openRetryDelaysMs = options.openRetryDelaysMs ?? PANE_STREAM_OPEN_RETRY_DELAYS_MS;
|
|
607
|
+
this.#deferredPaneRetryDelaysMs =
|
|
608
|
+
options.deferredPaneRetryDelaysMs ?? PANE_STREAM_DEFERRED_PANE_RETRY_DELAYS_MS;
|
|
547
609
|
this.#ownershipWaitMs = options.ownershipWaitMs ?? PANE_STREAM_OWNERSHIP_WAIT_MS;
|
|
548
610
|
this.#maxSocketBufferedBytes = boundedInteger(
|
|
549
611
|
options.maxSocketBufferedBytes,
|
|
@@ -624,13 +686,20 @@ export class PaneStreamAdmissionCoordinator {
|
|
|
624
686
|
this.#observability!.nowMicros(),
|
|
625
687
|
trace,
|
|
626
688
|
);
|
|
627
|
-
} catch {
|
|
689
|
+
} catch (error) {
|
|
690
|
+
// #585: the client is told only "stream-unavailable"; the log keeps why.
|
|
691
|
+
logger.info("pane-stream", "stream refused", {
|
|
692
|
+
step: "issue",
|
|
693
|
+
cause: "describe-session-failed",
|
|
694
|
+
session: context.sessionName,
|
|
695
|
+
error: errorText(error),
|
|
696
|
+
});
|
|
628
697
|
throw new PaneStreamAdmissionError(
|
|
629
698
|
"stream-unavailable",
|
|
630
699
|
"The workspace session could not be described.",
|
|
631
700
|
);
|
|
632
701
|
}
|
|
633
|
-
const known = new Set(described.
|
|
702
|
+
const known = new Set(tiledPanes(described).map((pane) => pane.semanticPaneId));
|
|
634
703
|
for (const pane of request.panes) {
|
|
635
704
|
if (!known.has(pane)) {
|
|
636
705
|
throw new PaneStreamAdmissionError(
|
|
@@ -643,7 +712,7 @@ export class PaneStreamAdmissionCoordinator {
|
|
|
643
712
|
// panes, as the trusted inventory places them now.
|
|
644
713
|
if (request.semanticWindowId !== undefined) {
|
|
645
714
|
const windowPanes = new Set(
|
|
646
|
-
described
|
|
715
|
+
tiledPanes(described)
|
|
647
716
|
.filter((pane) => pane.semanticWindowId === request.semanticWindowId)
|
|
648
717
|
.map((pane) => pane.semanticPaneId),
|
|
649
718
|
);
|
|
@@ -951,6 +1020,7 @@ export class PaneStreamAdmissionCoordinator {
|
|
|
951
1020
|
ledger: this.#ledger,
|
|
952
1021
|
drainTickMs: this.#drainTickMs,
|
|
953
1022
|
openRetryDelaysMs: this.#openRetryDelaysMs,
|
|
1023
|
+
deferredPaneRetryDelaysMs: this.#deferredPaneRetryDelaysMs,
|
|
954
1024
|
ownershipWaitMs: this.#ownershipWaitMs,
|
|
955
1025
|
maxSocketBufferedBytes: this.#maxSocketBufferedBytes,
|
|
956
1026
|
maxInputFrames: this.#maxInputFrames,
|
|
@@ -1079,6 +1149,10 @@ class PreAuthAdmission implements PaneStreamPreAuthAdmission {
|
|
|
1079
1149
|
this.close(1008, "upgrade-rejected");
|
|
1080
1150
|
}
|
|
1081
1151
|
|
|
1152
|
+
redeemFromUpgrade(frame: Buffer): void {
|
|
1153
|
+
this.#onMessage(frame, false);
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1082
1156
|
promote(): void {
|
|
1083
1157
|
if (!this.#open) return;
|
|
1084
1158
|
this.#promoted = true;
|
|
@@ -1133,6 +1207,11 @@ class PreAuthAdmission implements PaneStreamPreAuthAdmission {
|
|
|
1133
1207
|
void this.#onRedeem(this, frame, socket).catch((error: unknown) => {
|
|
1134
1208
|
if (!this.#open) return;
|
|
1135
1209
|
const code = errorFrameCode(error);
|
|
1210
|
+
logger.info("pane-stream", "stream refused", {
|
|
1211
|
+
step: "redeem",
|
|
1212
|
+
code,
|
|
1213
|
+
error: errorText(error),
|
|
1214
|
+
});
|
|
1136
1215
|
try {
|
|
1137
1216
|
sendControl(socket, {
|
|
1138
1217
|
type: "error",
|
|
@@ -1175,6 +1254,7 @@ interface LiveConnectionOptions {
|
|
|
1175
1254
|
readonly ledger: PaneStreamWireLedger;
|
|
1176
1255
|
readonly drainTickMs: number;
|
|
1177
1256
|
readonly openRetryDelaysMs: readonly number[];
|
|
1257
|
+
readonly deferredPaneRetryDelaysMs: readonly number[];
|
|
1178
1258
|
readonly ownershipWaitMs: number;
|
|
1179
1259
|
readonly maxSocketBufferedBytes: number;
|
|
1180
1260
|
readonly maxInputFrames: number;
|
|
@@ -1214,6 +1294,12 @@ interface OpenedPaneDelivery {
|
|
|
1214
1294
|
|
|
1215
1295
|
/** About half a second in all: long enough for one slow tmux answer, short for a user. */
|
|
1216
1296
|
export const PANE_STREAM_OPEN_RETRY_DELAYS_MS: readonly number[] = [150, 400];
|
|
1297
|
+
/**
|
|
1298
|
+
* A pane whose delivery still fails after those is tried again this long
|
|
1299
|
+
* after the stream opened without it (about 7 s in all, inside the terminal
|
|
1300
|
+
* app's 15 s wait for a hidden pane's state). Then the stream closes (#585).
|
|
1301
|
+
*/
|
|
1302
|
+
export const PANE_STREAM_DEFERRED_PANE_RETRY_DELAYS_MS: readonly number[] = [1_000, 2_000, 4_000];
|
|
1217
1303
|
/** Input waits this long for ownership to be read again before the stream closes. */
|
|
1218
1304
|
export const PANE_STREAM_OWNERSHIP_WAIT_MS = 2_000;
|
|
1219
1305
|
/** At most this many input and geometry frames wait for it. */
|
|
@@ -1308,6 +1394,9 @@ export class PaneStreamLiveConnection {
|
|
|
1308
1394
|
readonly #ledger: PaneStreamWireLedger;
|
|
1309
1395
|
readonly #drainTickMs: number;
|
|
1310
1396
|
readonly #openRetryDelaysMs: readonly number[];
|
|
1397
|
+
/** Waits of `#deferPane`; a close ends them at once (#585). */
|
|
1398
|
+
readonly #deferralWaits = new Set<{ timer: ReturnType<typeof setTimeout>; wake: () => void }>();
|
|
1399
|
+
readonly #deferredPaneRetryDelaysMs: readonly number[];
|
|
1311
1400
|
readonly #ownershipWaitMs: number;
|
|
1312
1401
|
readonly #maxSocketBufferedBytes: number;
|
|
1313
1402
|
readonly #maxInputFrames: number;
|
|
@@ -1453,6 +1542,7 @@ export class PaneStreamLiveConnection {
|
|
|
1453
1542
|
this.#ledger = options.ledger;
|
|
1454
1543
|
this.#drainTickMs = options.drainTickMs;
|
|
1455
1544
|
this.#openRetryDelaysMs = options.openRetryDelaysMs;
|
|
1545
|
+
this.#deferredPaneRetryDelaysMs = options.deferredPaneRetryDelaysMs;
|
|
1456
1546
|
this.#ownershipWaitMs = options.ownershipWaitMs ?? PANE_STREAM_OWNERSHIP_WAIT_MS;
|
|
1457
1547
|
this.#maxSocketBufferedBytes = options.maxSocketBufferedBytes;
|
|
1458
1548
|
this.#maxInputFrames = options.maxInputFrames;
|
|
@@ -1540,10 +1630,11 @@ export class PaneStreamLiveConnection {
|
|
|
1540
1630
|
* none of them. The log says which one, with the error text, so a stream
|
|
1541
1631
|
* that "just closed" can be traced without a reproduction.
|
|
1542
1632
|
*/
|
|
1543
|
-
#fail(cause: string, error?: unknown): void {
|
|
1633
|
+
#fail(cause: string, error?: unknown, pane?: string): void {
|
|
1544
1634
|
if (this.#closed) return;
|
|
1545
1635
|
this.#closeCause = {
|
|
1546
1636
|
cause,
|
|
1637
|
+
...(pane === undefined ? {} : { pane }),
|
|
1547
1638
|
...(error === undefined
|
|
1548
1639
|
? {}
|
|
1549
1640
|
: { error: (error instanceof Error ? error.message : String(error)).slice(0, 300) }),
|
|
@@ -1551,6 +1642,17 @@ export class PaneStreamLiveConnection {
|
|
|
1551
1642
|
this.close(1011, "stream-unavailable");
|
|
1552
1643
|
}
|
|
1553
1644
|
|
|
1645
|
+
/**
|
|
1646
|
+
* #872: every pane that did not open is held back after failed recoveries.
|
|
1647
|
+
* "Try again later", with the time left and why, so a client can say so
|
|
1648
|
+
* instead of counting attempts. The client reconnects as for any close.
|
|
1649
|
+
*/
|
|
1650
|
+
#closeHeld(hold: PaneStreamPaneHold, pane?: string): void {
|
|
1651
|
+
if (this.#closed) return;
|
|
1652
|
+
this.#closeCause = { cause: "pane-held", ...(pane === undefined ? {} : { pane }) };
|
|
1653
|
+
this.close(PANE_STREAM_PANE_HELD_CLOSE_CODE, paneHeldCloseReason(hold));
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1554
1656
|
close(code = 1000, reason = "stream-closed"): void {
|
|
1555
1657
|
if (this.#closed) return;
|
|
1556
1658
|
this.#recordDiagnosticLifecycle("pane-stream-terminal", code, reason);
|
|
@@ -1569,6 +1671,11 @@ export class PaneStreamLiveConnection {
|
|
|
1569
1671
|
: {}),
|
|
1570
1672
|
});
|
|
1571
1673
|
this.#closed = true;
|
|
1674
|
+
for (const { timer, wake } of this.#deferralWaits) {
|
|
1675
|
+
clearTimeout(timer);
|
|
1676
|
+
wake();
|
|
1677
|
+
}
|
|
1678
|
+
this.#deferralWaits.clear();
|
|
1572
1679
|
this.#ownershipHeld.length = 0;
|
|
1573
1680
|
this.#ownershipWake?.();
|
|
1574
1681
|
for (const demand of this.#surfaceDemands.values()) demand.close();
|
|
@@ -1645,7 +1752,7 @@ export class PaneStreamLiveConnection {
|
|
|
1645
1752
|
return;
|
|
1646
1753
|
}
|
|
1647
1754
|
if (this.#closed) return;
|
|
1648
|
-
const known = new Set(described.
|
|
1755
|
+
const known = new Set(tiledPanes(described).map((pane) => pane.semanticPaneId));
|
|
1649
1756
|
if (this.#descriptor.terminalDelivery) {
|
|
1650
1757
|
await this.#subscribeSemantic(known);
|
|
1651
1758
|
return;
|
|
@@ -1837,20 +1944,50 @@ export class PaneStreamLiveConnection {
|
|
|
1837
1944
|
// removes N x attachment latency without allowing a fast pane to make the
|
|
1838
1945
|
// session look ready while a sibling is still missing. allSettled is
|
|
1839
1946
|
// deliberate: partial success is always closed before the socket retires.
|
|
1947
|
+
if (this.#descriptor.retryAskedByPerson)
|
|
1948
|
+
this.#mirror.liftRecoveryHolds?.(
|
|
1949
|
+
this.#descriptor.sessionName,
|
|
1950
|
+
channels.map((channel) => channel.semanticPaneId),
|
|
1951
|
+
);
|
|
1840
1952
|
const openings = channels.map((channel) => this.#openPaneDelivery(binding, offer, channel));
|
|
1841
1953
|
const settled = await Promise.allSettled(openings);
|
|
1842
1954
|
const opened = settled.flatMap((result) =>
|
|
1843
1955
|
result.status === "fulfilled" ? [result.value] : [],
|
|
1844
1956
|
);
|
|
1957
|
+
// #585: one pane that still fails no longer takes the others down. The
|
|
1958
|
+
// stream opens without it and the pane is tried again (`#deferPane`). A
|
|
1959
|
+
// refusal (authority, or a delivery offer not accepted) still closes it.
|
|
1960
|
+
const deferred = channels.flatMap((channel, index) => {
|
|
1961
|
+
const result = settled[index]!;
|
|
1962
|
+
return result.status === "rejected" ? [{ channel, error: result.reason as unknown }] : [];
|
|
1963
|
+
});
|
|
1964
|
+
const deferrable =
|
|
1965
|
+
deferred.length > 0 &&
|
|
1966
|
+
deferred.length < channels.length &&
|
|
1967
|
+
this.#deferredPaneRetryDelaysMs.length > 0 &&
|
|
1968
|
+
opened.every(({ delivery }) => delivery.negotiation.accepted) &&
|
|
1969
|
+
// A held pane is refused until its hold ends: deferred tries only
|
|
1970
|
+
// repeat the refusal, so it closes at once with its hold (#872).
|
|
1971
|
+
deferred.every(
|
|
1972
|
+
({ error }) =>
|
|
1973
|
+
!(error instanceof SessionRuntimeControllerLeaseError) &&
|
|
1974
|
+
!(error instanceof MirrorPaneHeldError),
|
|
1975
|
+
);
|
|
1845
1976
|
if (
|
|
1846
1977
|
this.#closed ||
|
|
1847
|
-
|
|
1848
|
-
(
|
|
1849
|
-
|
|
1978
|
+
(!deferrable &&
|
|
1979
|
+
settled.some(
|
|
1980
|
+
(result) => result.status === "rejected" || !result.value.delivery.negotiation.accepted,
|
|
1981
|
+
))
|
|
1850
1982
|
) {
|
|
1851
1983
|
await Promise.all(opened.map(({ delivery }) => delivery.close().catch(() => undefined)));
|
|
1852
1984
|
if (!this.#closed) {
|
|
1853
1985
|
const rejected = settled.find((result) => result.status === "rejected");
|
|
1986
|
+
const hold = heldOnly(settled);
|
|
1987
|
+
if (hold) {
|
|
1988
|
+
this.#closeHeld(hold);
|
|
1989
|
+
return;
|
|
1990
|
+
}
|
|
1854
1991
|
this.#fail(
|
|
1855
1992
|
"delivery-negotiation-failed",
|
|
1856
1993
|
rejected?.status === "rejected" ? rejected.reason : "a pane's delivery offer was refused",
|
|
@@ -1920,21 +2057,91 @@ export class PaneStreamLiveConnection {
|
|
|
1920
2057
|
Number(visibleAtDelivery.has(left.channel.semanticPaneId)),
|
|
1921
2058
|
);
|
|
1922
2059
|
await this.#publishOpenedDeliveries(opened);
|
|
2060
|
+
if (deferrable)
|
|
2061
|
+
for (const { channel, error } of deferred)
|
|
2062
|
+
void this.#deferPane(binding, offer, channel, error);
|
|
1923
2063
|
this.#closeIfAllPanesGone();
|
|
1924
2064
|
}
|
|
1925
2065
|
|
|
2066
|
+
/**
|
|
2067
|
+
* A pane left out of the opening (#585): try its delivery again after each
|
|
2068
|
+
* deferred delay and announce it like a pane added in place. Only when
|
|
2069
|
+
* every try failed does the stream close, naming the pane.
|
|
2070
|
+
*/
|
|
2071
|
+
async #deferPane(
|
|
2072
|
+
binding: SessionRuntimePaneStreamTransportBinding,
|
|
2073
|
+
offer: NonNullable<PaneStreamLeaseDescriptor["terminalDelivery"]>,
|
|
2074
|
+
channel: PaneChannel,
|
|
2075
|
+
firstError: unknown,
|
|
2076
|
+
): Promise<void> {
|
|
2077
|
+
const gone = () =>
|
|
2078
|
+
this.#closed || channel.closed || this.#panes.get(channel.semanticPaneId) !== channel;
|
|
2079
|
+
let error = firstError;
|
|
2080
|
+
for (const [index, delayMs] of this.#deferredPaneRetryDelaysMs.entries()) {
|
|
2081
|
+
if (gone()) return;
|
|
2082
|
+
logger.info("pane-stream", "pane delivery deferred", {
|
|
2083
|
+
session: this.#descriptor.sessionName,
|
|
2084
|
+
clientId: this.#clientId,
|
|
2085
|
+
pane: channel.semanticPaneId,
|
|
2086
|
+
attempt: index + 1,
|
|
2087
|
+
error: errorText(error),
|
|
2088
|
+
});
|
|
2089
|
+
await new Promise<void>((resolve) => {
|
|
2090
|
+
const wait = {
|
|
2091
|
+
timer: setTimeout(() => {
|
|
2092
|
+
this.#deferralWaits.delete(wait);
|
|
2093
|
+
resolve();
|
|
2094
|
+
}, delayMs),
|
|
2095
|
+
wake: resolve,
|
|
2096
|
+
};
|
|
2097
|
+
wait.timer.unref?.();
|
|
2098
|
+
this.#deferralWaits.add(wait);
|
|
2099
|
+
});
|
|
2100
|
+
if (gone()) return;
|
|
2101
|
+
let entry: OpenedPaneDelivery;
|
|
2102
|
+
try {
|
|
2103
|
+
entry = await this.#openPaneDelivery(binding, offer, channel, false);
|
|
2104
|
+
} catch (cause) {
|
|
2105
|
+
if (cause instanceof SessionRuntimeControllerLeaseError) {
|
|
2106
|
+
this.#fail("pane-delivery-open-failed", cause, channel.semanticPaneId);
|
|
2107
|
+
return;
|
|
2108
|
+
}
|
|
2109
|
+
// The pane became held during its deferred tries (#872).
|
|
2110
|
+
if (cause instanceof MirrorPaneHeldError) {
|
|
2111
|
+
if (!gone()) this.#closeHeld(cause.hold, channel.semanticPaneId);
|
|
2112
|
+
return;
|
|
2113
|
+
}
|
|
2114
|
+
error = cause;
|
|
2115
|
+
continue;
|
|
2116
|
+
}
|
|
2117
|
+
if (gone()) {
|
|
2118
|
+
await entry.delivery.close().catch(() => undefined);
|
|
2119
|
+
return;
|
|
2120
|
+
}
|
|
2121
|
+
if (!entry.delivery.negotiation.accepted || this.#deliveryIdentityChanged(entry)) {
|
|
2122
|
+
await entry.delivery.close().catch(() => undefined);
|
|
2123
|
+
this.#failTopologyChanged();
|
|
2124
|
+
return;
|
|
2125
|
+
}
|
|
2126
|
+
await this.#publishOpenedDeliveries([entry]);
|
|
2127
|
+
return;
|
|
2128
|
+
}
|
|
2129
|
+
if (!gone()) this.#fail("pane-delivery-open-failed", error, channel.semanticPaneId);
|
|
2130
|
+
}
|
|
2131
|
+
|
|
1926
2132
|
/** Open one pane's delivery; its messages wait until the pane is announced. */
|
|
1927
2133
|
async #openPaneDelivery(
|
|
1928
2134
|
binding: SessionRuntimePaneStreamTransportBinding,
|
|
1929
2135
|
offer: NonNullable<PaneStreamLeaseDescriptor["terminalDelivery"]>,
|
|
1930
2136
|
channel: PaneChannel,
|
|
2137
|
+
retry = true,
|
|
1931
2138
|
): Promise<OpenedPaneDelivery> {
|
|
1932
2139
|
const pending: TerminalDeliveryServerMessage[] = [];
|
|
1933
2140
|
let ready = false;
|
|
1934
2141
|
let negotiated = false;
|
|
1935
2142
|
// #585: a failed open is tried again (150 ms, 400 ms) before the stream
|
|
1936
2143
|
// closes; this applies to a pane added in place too.
|
|
1937
|
-
const
|
|
2144
|
+
const open = () => {
|
|
1938
2145
|
// A try that failed may have delivered something; start clean.
|
|
1939
2146
|
pending.length = 0;
|
|
1940
2147
|
return binding.openTerminalDelivery(
|
|
@@ -1947,7 +2154,16 @@ export class PaneStreamLiveConnection {
|
|
|
1947
2154
|
},
|
|
1948
2155
|
this.#descriptor.workspaceName,
|
|
1949
2156
|
);
|
|
1950
|
-
}
|
|
2157
|
+
};
|
|
2158
|
+
// A held pane is refused without asking tmux until its hold ends: trying
|
|
2159
|
+
// again inside the same stream only repeats the refusal (#872).
|
|
2160
|
+
const delivery = retry
|
|
2161
|
+
? await this.#retryOpenStep(
|
|
2162
|
+
"pane-delivery-open",
|
|
2163
|
+
open,
|
|
2164
|
+
(error) => error instanceof MirrorPaneHeldError,
|
|
2165
|
+
)
|
|
2166
|
+
: await open();
|
|
1951
2167
|
return {
|
|
1952
2168
|
channel,
|
|
1953
2169
|
delivery,
|
|
@@ -2807,7 +3023,7 @@ export class PaneStreamLiveConnection {
|
|
|
2807
3023
|
return this.#topologyFailed("session inventory unavailable", error);
|
|
2808
3024
|
}
|
|
2809
3025
|
if (this.#closed) return this.#topologyFailed("closed");
|
|
2810
|
-
const next = [...new Set(described.
|
|
3026
|
+
const next = [...new Set(tiledPanes(described).map((pane) => pane.semanticPaneId))].sort();
|
|
2811
3027
|
if (next.length === 0) return this.#topologyFailed("session has no panes");
|
|
2812
3028
|
const frames = this.#validateInitialLayout(snapshot.layouts, next);
|
|
2813
3029
|
if (!frames) return "stale";
|
|
@@ -2828,7 +3044,7 @@ export class PaneStreamLiveConnection {
|
|
|
2828
3044
|
if (window !== null) {
|
|
2829
3045
|
windowPanes = [
|
|
2830
3046
|
...new Set(
|
|
2831
|
-
described
|
|
3047
|
+
tiledPanes(described)
|
|
2832
3048
|
.filter((pane) => pane.semanticWindowId === window)
|
|
2833
3049
|
.map((pane) => pane.semanticPaneId),
|
|
2834
3050
|
),
|
|
@@ -3370,6 +3586,18 @@ export class PaneStreamLiveConnection {
|
|
|
3370
3586
|
channel.delivery.projectionReceipt(frame.receipt);
|
|
3371
3587
|
return;
|
|
3372
3588
|
}
|
|
3589
|
+
if (frame.type === "terminal-delivery-history-request") {
|
|
3590
|
+
const channel = this.#deliveryChannel(frame.request);
|
|
3591
|
+
if (!channel) return;
|
|
3592
|
+
if (
|
|
3593
|
+
!channel.delivery?.historyRequest ||
|
|
3594
|
+
!channel.delivery.negotiation.accepted ||
|
|
3595
|
+
channel.delivery.negotiation.negotiated.partialHistory !== "tail-v1"
|
|
3596
|
+
)
|
|
3597
|
+
return this.#failProtocol("protocol-error");
|
|
3598
|
+
channel.delivery.historyRequest(frame.request);
|
|
3599
|
+
return;
|
|
3600
|
+
}
|
|
3373
3601
|
if (frame.type === "terminal-projection-materialize") {
|
|
3374
3602
|
const channel = this.#deliveryChannel(frame.request);
|
|
3375
3603
|
if (!channel) return;
|
|
@@ -38,7 +38,51 @@ export interface ParsedLayout {
|
|
|
38
38
|
/** The root cell's WxH — the authoritative window size. */
|
|
39
39
|
width: number;
|
|
40
40
|
height: number;
|
|
41
|
+
/** The tiled panes only. */
|
|
41
42
|
leaves: LayoutLeaf[];
|
|
43
|
+
/**
|
|
44
|
+
* #882: floating panes, listed but not placed in the tiled tree. Present
|
|
45
|
+
* only when tmux-ide's bundled tmux (3.7c) sends its `<…>` section; stock
|
|
46
|
+
* tmux 3.8 leaves floating panes out of a control client's layout.
|
|
47
|
+
*/
|
|
48
|
+
floating?: LayoutLeaf[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* #882: the bundled build appends `<cell,cell…>`, one leaf cell per floating
|
|
53
|
+
* pane, and also lists each one as an extra child of the root split, where it
|
|
54
|
+
* overlaps the tiled panes. Split the string into the tiled part and the
|
|
55
|
+
* floating leaves; each floating id must occur exactly once in the tiled part
|
|
56
|
+
* and once in the section. Null when the section is malformed.
|
|
57
|
+
*/
|
|
58
|
+
function splitFloating(s: string): { tiled: string; floating: LayoutLeaf[] } | null {
|
|
59
|
+
if (!s.endsWith(">")) return { tiled: s, floating: [] };
|
|
60
|
+
const open = s.lastIndexOf("<");
|
|
61
|
+
if (open <= 0) return null;
|
|
62
|
+
const section = s.slice(open + 1, -1);
|
|
63
|
+
const floating: LayoutLeaf[] = [];
|
|
64
|
+
let pos = 0;
|
|
65
|
+
while (pos < section.length) {
|
|
66
|
+
const dims = readDims(section, pos);
|
|
67
|
+
if (!dims || section[dims.pos] !== ",") return null;
|
|
68
|
+
const id = readInt(section, dims.pos + 1);
|
|
69
|
+
if (!id) return null;
|
|
70
|
+
floating.push({
|
|
71
|
+
id: `%${id.value}`,
|
|
72
|
+
left: dims.left,
|
|
73
|
+
top: dims.top,
|
|
74
|
+
width: dims.width,
|
|
75
|
+
height: dims.height,
|
|
76
|
+
});
|
|
77
|
+
pos = id.pos;
|
|
78
|
+
if (pos === section.length) break;
|
|
79
|
+
if (section[pos] !== ",") return null;
|
|
80
|
+
pos += 1;
|
|
81
|
+
if (pos === section.length) return null;
|
|
82
|
+
}
|
|
83
|
+
if (floating.length === 0) return null;
|
|
84
|
+
if (new Set(floating.map((leaf) => leaf.id)).size !== floating.length) return null;
|
|
85
|
+
return { tiled: s.slice(0, open), floating };
|
|
42
86
|
}
|
|
43
87
|
|
|
44
88
|
/** Opt-in validated ancestry. Runtime pane IDs are not semantic pane identities. */
|
|
@@ -67,22 +111,50 @@ interface TreeContext {
|
|
|
67
111
|
*/
|
|
68
112
|
export function parseLayoutTree(layout: string): LayoutTreeNode | null {
|
|
69
113
|
if (layout.length > 64 * 1024 || !/^[0-9a-fA-F]{4},/.test(layout)) return null;
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
114
|
+
const split = splitFloating(layout.slice(5));
|
|
115
|
+
if (!split) return null;
|
|
116
|
+
const s = split.tiled;
|
|
117
|
+
const skip = floatingIds(split.floating);
|
|
118
|
+
const root = parseCell(s, 0, [], { nodes: 0, ids: new Set() }, 1, skip);
|
|
119
|
+
if (
|
|
120
|
+
!root?.node ||
|
|
121
|
+
root.pos !== s.length ||
|
|
122
|
+
root.node.left !== 0 ||
|
|
123
|
+
root.node.top !== 0 ||
|
|
124
|
+
!skip.allSeenOnce()
|
|
125
|
+
)
|
|
73
126
|
return null;
|
|
74
127
|
return root.node;
|
|
75
128
|
}
|
|
76
129
|
|
|
130
|
+
/** The floating ids to leave out of the tiled tree, each to be seen once. */
|
|
131
|
+
function floatingIds(floating: readonly LayoutLeaf[]) {
|
|
132
|
+
const seen = new Map(floating.map((leaf) => [leaf.id, 0]));
|
|
133
|
+
return {
|
|
134
|
+
has: (id: string) => seen.has(id),
|
|
135
|
+
see: (id: string) => seen.set(id, (seen.get(id) ?? 0) + 1),
|
|
136
|
+
allSeenOnce: () => [...seen.values()].every((count) => count === 1),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
type FloatingIds = ReturnType<typeof floatingIds>;
|
|
140
|
+
|
|
77
141
|
/** Parse a tmux layout string (`csum,WxH,X,Y…`). Null on any malformed input
|
|
78
142
|
* (the caller falls back to the slow list-panes path — never throw here). */
|
|
79
143
|
export function parseLayout(layout: string): ParsedLayout | null {
|
|
80
144
|
if (!/^[0-9a-fA-F]{4},/.test(layout)) return null;
|
|
81
|
-
const
|
|
145
|
+
const split = splitFloating(layout.slice(5));
|
|
146
|
+
if (!split) return null;
|
|
147
|
+
const s = split.tiled;
|
|
148
|
+
const skip = floatingIds(split.floating);
|
|
82
149
|
const leaves: LayoutLeaf[] = [];
|
|
83
|
-
const root = parseCell(s, 0, leaves);
|
|
84
|
-
if (!root || root.pos !== s.length) return null;
|
|
85
|
-
return {
|
|
150
|
+
const root = parseCell(s, 0, leaves, undefined, 1, skip);
|
|
151
|
+
if (!root || root.pos !== s.length || !skip.allSeenOnce() || leaves.length === 0) return null;
|
|
152
|
+
return {
|
|
153
|
+
width: root.width,
|
|
154
|
+
height: root.height,
|
|
155
|
+
leaves,
|
|
156
|
+
...(split.floating.length > 0 ? { floating: split.floating } : {}),
|
|
157
|
+
};
|
|
86
158
|
}
|
|
87
159
|
|
|
88
160
|
/** Recursive-descent cell parse from `pos`; appends leaves in layout order. */
|
|
@@ -92,7 +164,15 @@ function parseCell(
|
|
|
92
164
|
leaves: LayoutLeaf[],
|
|
93
165
|
tree?: TreeContext,
|
|
94
166
|
depth = 1,
|
|
95
|
-
|
|
167
|
+
skip?: FloatingIds,
|
|
168
|
+
): {
|
|
169
|
+
width: number;
|
|
170
|
+
height: number;
|
|
171
|
+
pos: number;
|
|
172
|
+
node?: LayoutTreeNode;
|
|
173
|
+
/** #882: a floating pane's copy inside the tiled part; its parent drops it. */
|
|
174
|
+
floating?: true;
|
|
175
|
+
} | null {
|
|
96
176
|
if (tree && (depth > 64 || ++tree.nodes > MAX_TREE_LEAVES * 2 - 1)) return null;
|
|
97
177
|
const dims = readDims(s, pos);
|
|
98
178
|
if (!dims) return null;
|
|
@@ -113,6 +193,10 @@ function parseCell(
|
|
|
113
193
|
const id = readInt(s, pos + 1);
|
|
114
194
|
if (!id) return null;
|
|
115
195
|
const leaf = { id: `%${id.value}`, left, top, width, height };
|
|
196
|
+
if (skip?.has(leaf.id)) {
|
|
197
|
+
skip.see(leaf.id);
|
|
198
|
+
return { width, height, pos: id.pos, floating: true };
|
|
199
|
+
}
|
|
116
200
|
if (tree) {
|
|
117
201
|
if (
|
|
118
202
|
!Number.isSafeInteger(id.value) ||
|
|
@@ -133,11 +217,13 @@ function parseCell(
|
|
|
133
217
|
if (ch === "{" || ch === "[") {
|
|
134
218
|
const close = ch === "{" ? "}" : "]";
|
|
135
219
|
const children: LayoutTreeNode[] = [];
|
|
220
|
+
let droppedFloating = 0;
|
|
136
221
|
pos++;
|
|
137
222
|
for (;;) {
|
|
138
|
-
const child = parseCell(s, pos, leaves, tree, depth + 1);
|
|
223
|
+
const child = parseCell(s, pos, leaves, tree, depth + 1, skip);
|
|
139
224
|
if (!child) return null;
|
|
140
|
-
if (
|
|
225
|
+
if (child.floating) droppedFloating += 1;
|
|
226
|
+
else if (tree && child.node) children.push(child.node);
|
|
141
227
|
pos = child.pos;
|
|
142
228
|
if (s[pos] === ",") {
|
|
143
229
|
pos++;
|
|
@@ -145,6 +231,19 @@ function parseCell(
|
|
|
145
231
|
}
|
|
146
232
|
if (s[pos] === close) {
|
|
147
233
|
if (!tree) return { width, height, pos: pos + 1 };
|
|
234
|
+
// A split left with one tiled child once its floats are dropped is
|
|
235
|
+
// that child (the bundled build wraps a lone pane and its floats).
|
|
236
|
+
// It must fill the split exactly; otherwise tilesParent refuses it.
|
|
237
|
+
const lone = children.length === 1 ? children[0]! : null;
|
|
238
|
+
if (
|
|
239
|
+
droppedFloating > 0 &&
|
|
240
|
+
lone &&
|
|
241
|
+
lone.left === left &&
|
|
242
|
+
lone.top === top &&
|
|
243
|
+
lone.width === width &&
|
|
244
|
+
lone.height === height
|
|
245
|
+
)
|
|
246
|
+
return { width, height, pos: pos + 1, node: lone };
|
|
148
247
|
const axis = ch === "{" ? "cols" : "rows";
|
|
149
248
|
const node: LayoutTreeNode = { kind: "split", axis, left, top, width, height, children };
|
|
150
249
|
if (!tilesParent(node)) return null;
|