summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/exec.zig b/src/exec.zig
index ad051c32..a1894b7f 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -398,7 +398,7 @@ fn askWrite(p: *Pardes, id: usize, serial: u32, path: []const u8) void {
} });
}
-/// Tty: a shell in the caller's directory, raw from the first frame,
+/// Term: a shell in the caller's directory, raw from the first frame,
/// stacked below the caller like Alt-n's new shell.
pub fn spawnTty(p: *Pardes, from: usize) ?*Pane {
// No pane asking (an empty window's tag): the session's directory, as
@@ -409,26 +409,26 @@ pub fn spawnTty(p: *Pardes, from: usize) ?*Pane {
const dir = p.execDir(from);
if (missingDir(p, dir)) {
var said: [pardes.memory.limits.host_path_cap + 48]u8 = undefined;
- p.reportFailure(from, std.fmt.bufPrint(&said, "Tty: {s}: no such directory", .{dir}) catch "Tty: no such directory");
+ p.reportFailure(from, std.fmt.bufPrint(&said, "Term: {s}: no such directory", .{dir}) catch "Term: no such directory");
return null;
}
const free = p.freeSlot() orelse {
- p.reportError(from, "Tty", error.NoPaneSlots);
+ p.reportError(from, "Term", error.NoPaneSlots);
return null;
};
const nt = p.newShell(free, dir) catch |err| {
if (err == error.PathTooLong) {
- p.reportFailure(from, std.fmt.comptimePrint("Tty: its directory is longer than a path may be ({d} bytes)", .{pardes.memory.limits.host_path_cap}));
+ p.reportFailure(from, std.fmt.comptimePrint("Term: its directory is longer than a path may be ({d} bytes)", .{pardes.memory.limits.host_path_cap}));
return null;
}
- p.reportError(from, "Tty", err);
+ p.reportError(from, "Term", err);
return null;
};
nt.greet = true;
nt.body.mode = .tty;
placeNew(p, from, from, free, .shell);
if (refusedPlacement(p, free)) {
- p.reportError(from, "Tty", error.NoPaneRoom);
+ p.reportError(from, "Term", error.NoPaneRoom);
return null;
}
return nt;
@@ -786,7 +786,7 @@ fn runCommand(p: *Pardes, from: usize, line: []const u8) ?usize {
// its own to reuse.
const src = p.panes[from];
const dir = p.execDir(from);
- // A directory that is not there runs nothing, as Tty makes nothing
+ // A directory that is not there runs nothing, as Term makes nothing
// there: no pane, and the write fails ENOENT.
if (missingDir(p, dir)) {
var said: [pardes.memory.limits.host_path_cap + 48]u8 = undefined;
@@ -931,9 +931,11 @@ pub fn namesBuiltin(txt: []const u8) bool {
/// acme's words, run by their pardes names (Put is Save; Delete is a Del
/// that does not ask), or refused, never run as a shell command: a Put that
-/// exited 127 looked like a save that worked.
+/// exited 127 looked like a save that worked. Tty, Term's old name, as
+/// saved dumps and users' tags still hold it, is here too.
pub const acme_words = [_]struct { acme: []const u8, pardes: ?[]const u8, hint: []const u8 = "" }{
.{ .acme = "Put", .pardes = "Save" },
+ .{ .acme = "Tty", .pardes = "Term" },
.{ .acme = "Delete", .pardes = "Del" },
.{ .acme = "Snarf", .pardes = null, .hint = ": y yanks the selection" },
.{ .acme = "Cut", .pardes = null, .hint = ": d deletes the selection into a register" },
@@ -951,7 +953,8 @@ pub fn executeBuiltinLine(p: *Pardes, id: usize, txt: []const u8) bool {
const raw = commandText(txt);
if (raw.len == 0 or p.exec_depth >= max_exec_depth) return false;
if (isComment(raw)) return true;
- const word_end = std.mem.indexOfAny(u8, raw, " \t") orelse raw.len;
+ // `+` too, so an old `Tty+fish` is renamed as `Tty fish` is.
+ const word_end = std.mem.indexOfAny(u8, raw, " \t+") orelse raw.len;
var renamed: [1024 + 16]u8 = undefined;
const cmd = for (acme_words) |w| {
if (!std.mem.eql(u8, raw[0..word_end], w.acme)) continue;
@@ -966,7 +969,7 @@ pub fn executeBuiltinLine(p: *Pardes, id: usize, txt: []const u8) bool {
};
break std.fmt.bufPrint(&renamed, "{s}{s}", .{ now, raw[word_end..] }) catch raw;
} else raw;
- // `Word arg`, or for a word that says so, `Word+arg` (`Tty+fish`).
+ // `Word arg`, or for a word that says so, `Word+arg` (`Term+fish`).
const plus = std.mem.indexOfScalar(u8, cmd, '+');
var sp = std.mem.indexOfAny(u8, cmd, " \t");
if (sp == null) if (plus) |at| if (std.meta.stringToEnum(Builtin, cmd[0..at])) |head| {
@@ -1378,7 +1381,7 @@ fn pardesDoc(p: *Pardes, from_id: usize, free: usize) void {
layout.columnFitsHalves(p, from_id, 100) and layout.splitColumn(p, from_id, free, true))
return;
// Without room for a first-document column, split the Look origin
- // just like Tty. Never displace (or evict) a top-left bystander.
+ // just like Term. Never displace (or evict) a top-left bystander.
belowParent(p, src_id orelse from_id, free);
}