summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
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();