@ordewell/core 0.4.4 → 0.4.5
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/dist/index.d.mts +23 -9
- package/dist/index.d.ts +23 -9
- package/dist/index.js +62 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10325,6 +10325,28 @@ function hasTmux(probe = defaultProbe) {
|
|
|
10325
10325
|
return false;
|
|
10326
10326
|
}
|
|
10327
10327
|
}
|
|
10328
|
+
var defaultHasBin = (bin) => {
|
|
10329
|
+
try {
|
|
10330
|
+
execSync2(`${process.platform === "win32" ? "where" : "which"} ${bin}`, { stdio: "ignore" });
|
|
10331
|
+
return true;
|
|
10332
|
+
} catch {
|
|
10333
|
+
return false;
|
|
10334
|
+
}
|
|
10335
|
+
};
|
|
10336
|
+
function clipboardCopyCommand(hasBin = defaultHasBin, platform = process.platform, env = process.env) {
|
|
10337
|
+
const candidates = platform === "darwin" ? [["pbcopy", "pbcopy"]] : platform === "win32" ? [["clip.exe", "clip.exe"]] : [
|
|
10338
|
+
// Only prefer wl-copy when there is a Wayland display to talk to —
|
|
10339
|
+
// on X11 it is often installed but fails at copy time.
|
|
10340
|
+
...env.WAYLAND_DISPLAY ? [["wl-copy", "wl-copy"]] : [],
|
|
10341
|
+
["xclip", "xclip -selection clipboard"],
|
|
10342
|
+
["xsel", "xsel --clipboard --input"],
|
|
10343
|
+
["wl-copy", "wl-copy"]
|
|
10344
|
+
];
|
|
10345
|
+
for (const [bin, command] of candidates) {
|
|
10346
|
+
if (hasBin(bin)) return command;
|
|
10347
|
+
}
|
|
10348
|
+
return null;
|
|
10349
|
+
}
|
|
10328
10350
|
|
|
10329
10351
|
// src/services/TmuxRunner.ts
|
|
10330
10352
|
var EXIT_RE = /<<<ORDEWELL_TMUX_EXIT:(\d+)>>>/;
|
|
@@ -10434,6 +10456,7 @@ var TmuxRunner = class extends AbstractRunner {
|
|
|
10434
10456
|
resolvePath;
|
|
10435
10457
|
pollIntervalMs;
|
|
10436
10458
|
logDir;
|
|
10459
|
+
clipboardCommand;
|
|
10437
10460
|
/** Retries get a freshly named window so a failed attempt's output stays inspectable. */
|
|
10438
10461
|
attempts = /* @__PURE__ */ new Map();
|
|
10439
10462
|
ready = null;
|
|
@@ -10445,6 +10468,7 @@ var TmuxRunner = class extends AbstractRunner {
|
|
|
10445
10468
|
this.resolvePath = deps.resolvePath ?? augmentedPath;
|
|
10446
10469
|
this.pollIntervalMs = deps.pollIntervalMs ?? 500;
|
|
10447
10470
|
this.logDir = deps.logDir ?? tmpdir();
|
|
10471
|
+
this.clipboardCommand = deps.clipboardCommand ?? (() => clipboardCopyCommand());
|
|
10448
10472
|
}
|
|
10449
10473
|
/**
|
|
10450
10474
|
* Reaps a session orphaned by a crashed prior daemon on the same port, then
|
|
@@ -10473,25 +10497,44 @@ var TmuxRunner = class extends AbstractRunner {
|
|
|
10473
10497
|
await this.configureScrolling();
|
|
10474
10498
|
}
|
|
10475
10499
|
/**
|
|
10476
|
-
*
|
|
10477
|
-
*
|
|
10478
|
-
*
|
|
10479
|
-
*
|
|
10480
|
-
*
|
|
10481
|
-
*
|
|
10482
|
-
*
|
|
10483
|
-
*
|
|
10500
|
+
* Gives an attached runner terminal wheel/PageUp scrolling over a deep
|
|
10501
|
+
* scrollback, and a mouse selection that reaches the system clipboard — none
|
|
10502
|
+
* of which a default tmux session does. Server-wide scoping is harmless: the
|
|
10503
|
+
* daemon owns a private socket (`tmuxSocketName`).
|
|
10504
|
+
*
|
|
10505
|
+
* `mouse on` is what costs the emulator's own drag-select, so tmux must hand
|
|
10506
|
+
* the selection back out itself: via a clipboard binary when there is one,
|
|
10507
|
+
* and via OSC 52 (`set-clipboard`) for what that cannot cover, such as
|
|
10508
|
+
* viewing over SSH. Naming the binary on the binding as well as in
|
|
10509
|
+
* `copy-command` keeps drag-to-copy working on tmux older than 3.2, which has
|
|
10510
|
+
* no `copy-command`.
|
|
10484
10511
|
*/
|
|
10485
10512
|
async configureScrolling() {
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10513
|
+
const clip = this.clipboardCommand();
|
|
10514
|
+
const copySelection = clip ? ["copy-pipe-and-cancel", clip] : ["copy-pipe-and-cancel"];
|
|
10515
|
+
const commands = [
|
|
10516
|
+
// `history-limit` only governs windows created after it is set, so it
|
|
10517
|
+
// must run before any `new-window` — once, here at session creation.
|
|
10518
|
+
["set-option", "-g", "history-limit", "100000"],
|
|
10519
|
+
["set-option", "-g", "mouse", "on"],
|
|
10520
|
+
["set-option", "-g", "set-clipboard", "on"],
|
|
10521
|
+
...clip ? [["set-option", "-g", "copy-command", clip]] : [],
|
|
10522
|
+
["bind-key", "-T", "copy-mode", "MouseDragEnd1Pane", "send-keys", "-X", ...copySelection],
|
|
10523
|
+
["bind-key", "-T", "copy-mode-vi", "MouseDragEnd1Pane", "send-keys", "-X", ...copySelection],
|
|
10524
|
+
// Root-table PageUp; otherwise the key goes to the inner app and never
|
|
10525
|
+
// reaches tmux's scrollback. Both mode tables, so `mode-keys` can't
|
|
10526
|
+
// decide whether paging works.
|
|
10527
|
+
["bind-key", "-n", "PageUp", "copy-mode", "-u"],
|
|
10528
|
+
["bind-key", "-T", "copy-mode", "PageUp", "send-keys", "-X", "page-up"],
|
|
10529
|
+
["bind-key", "-T", "copy-mode", "PageDown", "send-keys", "-X", "page-down"],
|
|
10530
|
+
["bind-key", "-T", "copy-mode-vi", "PageUp", "send-keys", "-X", "page-up"],
|
|
10531
|
+
["bind-key", "-T", "copy-mode-vi", "PageDown", "send-keys", "-X", "page-down"]
|
|
10532
|
+
];
|
|
10533
|
+
for (const args of commands) {
|
|
10534
|
+
try {
|
|
10535
|
+
await this.tmux(args);
|
|
10536
|
+
} catch {
|
|
10537
|
+
}
|
|
10495
10538
|
}
|
|
10496
10539
|
}
|
|
10497
10540
|
/**
|
|
@@ -11416,6 +11459,7 @@ export {
|
|
|
11416
11459
|
clearAugmentedPathCache,
|
|
11417
11460
|
clearResearchShellCache,
|
|
11418
11461
|
clearState,
|
|
11462
|
+
clipboardCopyCommand,
|
|
11419
11463
|
coerceAssignments,
|
|
11420
11464
|
collectDirectDependencyOutputs,
|
|
11421
11465
|
collectProviderCredentials,
|