storymode-cli 1.3.6 → 1.3.8
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/package.json +1 -1
- package/src/cli.mjs +7 -5
- package/src/player.mjs +11 -12
package/package.json
CHANGED
package/src/cli.mjs
CHANGED
|
@@ -253,16 +253,18 @@ export async function run(args) {
|
|
|
253
253
|
// iTerm2 (not in tmux): use native split to keep HD working.
|
|
254
254
|
// iTerm2 inline images can't be cleared through tmux passthrough,
|
|
255
255
|
// so we avoid tmux entirely and use AppleScript to split the pane.
|
|
256
|
+
// Use "write text" instead of "command" — the latter uses execve directly
|
|
257
|
+
// (no shell, no PATH, no env vars). "write text" types into the new
|
|
258
|
+
// pane's shell, which inherits everything.
|
|
256
259
|
if (renderMode.protocol === 'iterm2' && !renderMode.inTmux) {
|
|
257
260
|
try {
|
|
258
|
-
// Wrap in bash -c: iTerm2's "command" uses execve directly (no shell),
|
|
259
|
-
// so env vars and || operators won't work without an explicit shell.
|
|
260
|
-
const wrappedCmd = `bash -c '${companionCmd} || { echo; echo " Companion crashed. Press enter to close."; read; }'`;
|
|
261
|
-
const escapedCmd = wrappedCmd.replace(/"/g, '\\"');
|
|
262
261
|
execSync(`osascript -e '
|
|
263
262
|
tell application "iTerm2"
|
|
264
263
|
tell current session of current tab of current window
|
|
265
|
-
set newSession to split vertically with default profile
|
|
264
|
+
set newSession to split vertically with default profile
|
|
265
|
+
tell newSession
|
|
266
|
+
write text "${companionCmd.replace(/"/g, '\\"')}"
|
|
267
|
+
end tell
|
|
266
268
|
end tell
|
|
267
269
|
end tell
|
|
268
270
|
'`, { stdio: 'ignore' });
|
package/src/player.mjs
CHANGED
|
@@ -439,19 +439,18 @@ export async function playReactiveCompanion(animMap, opts = {}) {
|
|
|
439
439
|
const delSeq = `\x1b_Ga=d,d=a\x1b\\`;
|
|
440
440
|
stdout.write(hdInTmux ? wrapForTmux(delSeq) : delSeq);
|
|
441
441
|
writeKitty(currentPngFrames[idx], null, imageRows || undefined, hdInTmux);
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
if (!fullscreen) {
|
|
446
|
-
// Clear the image area to release old images
|
|
447
|
-
for (let i = 0; i < maxLines; i++) stdout.write('\x1b[K\n');
|
|
448
|
-
stdout.write(fullscreen ? '\x1b[H' : '\x1b8');
|
|
442
|
+
// Kitty needs explicit cursor positioning after image
|
|
443
|
+
if (imageRows > 0) {
|
|
444
|
+
stdout.write(`\x1b[${imageRows + 1};1H`);
|
|
449
445
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
446
|
+
} else {
|
|
447
|
+
// iTerm2: clear screen to release previous inline images from memory,
|
|
448
|
+
// then render new image. Cursor advances past the image automatically.
|
|
449
|
+
stdout.write('\x1b[2J\x1b[H');
|
|
450
|
+
// Use width=pane columns, let preserveAspectRatio size the height
|
|
451
|
+
const paneCols = process.stdout.columns || 80;
|
|
452
|
+
writeIterm2(currentPngFrames[idx], paneCols, null, hdInTmux);
|
|
453
|
+
stdout.write('\n'); // ensure cursor is on next line after image
|
|
455
454
|
}
|
|
456
455
|
} else {
|
|
457
456
|
// --- ANSI fallback path ---
|