summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 09:01:46 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit039ae6aa70d963f942d8a5747060c67599664af9 (patch)
tree3f6448c9a7b3db81a076edeefce081990a9eea24 /src/exec.zig
parente0a2fd56777cf0f571125650ec74e75c3f6a8c44 (diff)
downloadpardes-039ae6aa70d963f942d8a5747060c67599664af9.tar.gz
pardes-039ae6aa70d963f942d8a5747060c67599664af9.zip
A terminal is typed into only when idle at an empty prompt
A look at a directory, or an exec at a terminal, typed its line after whatever sat unsent at the prompt and ran the two joined (`echo TYPEDls`). A terminal with text at its prompt now takes no line; a look at its directory opens a new terminal, an exec runs as a command pane. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/exec.zig b/src/exec.zig
index 6e437093..ebe90b98 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -37,6 +37,12 @@ pub fn takesCommandLine(p: *const Pardes, id: usize) bool {
const pane = p.panes[id] orelse return false;
// A command pane's child is its command, never a shell to type at.
if (!pane.isTerminal() or pane.command != null) return false;
+ // Someone's line at the shell's prompt, typed and not sent: typing a
+ // command there would run it joined to theirs (`echo TYPEDls`). Only an
+ // idle, EMPTY prompt is typed at; otherwise a new pane runs the line.
+ // (Text in pardes's own edit buffer is not the shell's yet: an exec of
+ // it, or of anything, types only what it runs.)
+ if (panes.Terminal.promptInputReady(pane) and !panes.Terminal.promptInputEmpty(pane)) return false;
// A mounted shell sits behind sudo's process supervisor. Its OSC 133
// prompt marks identify input readiness; the launcher's executable is
// not the shell executable used by the ordinary process heuristic.
@@ -371,7 +377,7 @@ fn spawnTtyWithMount(p: *Pardes, from: usize, v9fs: bool) ?*Pane {
/// Whether `path` is a directory on this host, the turn out while it asks
/// (it may be inside a mount this editor serves).
-fn isDirectory(path: []const u8) bool {
+pub fn isDirectory(path: []const u8) bool {
var buf: [4096]u8 = undefined;
const z = std.fmt.bufPrintSentinel(&buf, "{s}", .{path}, 0) catch return false;
pardes.turn.yield();