summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CHANGELOG.md5
-rw-r--r--src/main.zig5
-rw-r--r--src/pardes.zig2
-rw-r--r--test/agent_session.py2
-rw-r--r--test/daemon.py8
-rw-r--r--test/e2e_harness.zig2
-rw-r--r--test/fs.py2
-rw-r--r--test/process.zig8
-rw-r--r--test/process/builtins.zig8
-rw-r--r--test/process/flags.zig25
-rw-r--r--test/process/mounts.zig6
-rw-r--r--test/process/root_ctl.zig10
-rw-r--r--test/selfmount.py6
-rw-r--r--test/snapshots/ttyonly.snap4
14 files changed, 48 insertions, 45 deletions
diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md
index f6607176..f21fcacc 100644
--- a/src/CHANGELOG.md
+++ b/src/CHANGELOG.md
@@ -28,6 +28,11 @@
- `Tty9p` and its `pardes-v9fs` helper are gone (a terminal with the
session kernel-mounted through Linux v9fs, a one-off), with their tests;
a kernel mount made by hand still works, as the build notes say.
+- The terminal frontend is the tui: `zig build -Dplatform=tui`, its code
+ in `src/tui/` (the binary is still `pardes`, and `--tty` still starts
+ one shell pane in tty mode). The builtin that opens a terminal pane,
+ `Tty`, is `Term` (`SPC n t`); `Tty` still runs it, as acme's words run
+ theirs.
- One `pardes --daemon` per user keeps sessions, started by the first
session and gone once it keeps nothing. `pardes` in a terminal forks
its session off and stays as its stub: `Detach` (`SPC s D`), or a
diff --git a/src/main.zig b/src/main.zig
index 16675265..9092e2f9 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -76,8 +76,7 @@ const help_text =
\\terminal's PAGER), else a new editor's.
\\
\\Options:
- \\ --tui start as one shell pane already in tty mode
- \\ (--tty, its old spelling, too)
+ \\ --tty start as one shell pane already in tty mode
\\ -n <count> initial shell panes: 1 (default) or 3 (classic).
\\ A FILE argument boots just that file instead.
\\ --tty-toggle <key> use Ctrl-<key> to toggle tty/editor mode
@@ -436,7 +435,7 @@ fn nativeMain(std_init: std.process.Init) !void {
var i: usize = if (resuming) 2 else 1;
while (i < args.len) : (i += 1) {
const a = args[i];
- if (std.mem.eql(u8, a, "--tui") or std.mem.eql(u8, a, "--tty")) {
+ if (std.mem.eql(u8, a, "--tty")) {
explicit_tty = true;
} else if (std.mem.startsWith(u8, a, "--tty-toggle=")) {
session_only = false;
diff --git a/src/pardes.zig b/src/pardes.zig
index 89e99a9b..eb27c70c 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -3816,7 +3816,7 @@ pub const Options = struct {
/// window's build replaying a terminal's session starts as it did.
windowed: bool = platform == .gui,
/// The layout to boot, when a host means one outright rather than leaving
- /// it to be read off the options below. `--tui` names `.tty`; a core
+ /// it to be read off the options below. `--tty` names `.tty`; a core
/// booted for a test names nothing and gets `.tty_shell`.
boot: ?Boot = null,
/// initial shell panes: 1 (default) or 3 for the classic two-column boot.
diff --git a/test/agent_session.py b/test/agent_session.py
index 8a62bf26..aa87c845 100644
--- a/test/agent_session.py
+++ b/test/agent_session.py
@@ -47,7 +47,7 @@ def run(args, command, status):
signal.setitimer(signal.ITIMER_REAL, args.timeout)
try:
context = session(str(args.binary.resolve()), root, 'agent-session', tty=True,
- socket_name='agent-session', launch=['--tui', '--9p=agent-session'],
+ socket_name='agent-session', launch=['--tty', '--9p=agent-session'],
inherited={'PARDES_TEST_GRID': '1'} if args.gui_grid else {})
client, _ = context.__enter__()
try:
diff --git a/test/daemon.py b/test/daemon.py
index 7db7e055..f3c927ad 100644
--- a/test/daemon.py
+++ b/test/daemon.py
@@ -1078,7 +1078,7 @@ def main(binary, cycles):
started = []
try:
term = Term()
- stub = term.spawn([binary, '--tui', '--9p=work'], env)
+ stub = term.spawn([binary, '--tty', '--9p=work'], env)
started.append(stub.pid)
sock = root / 'pardes-9p-work.sock'
wait_for('the session\'s 9P socket', sock.exists)
@@ -1181,7 +1181,7 @@ def main(binary, cycles):
term = Term()
stub_pid = root / 'stub.pid'
shell = term.spawn(['sh', '-c', '"$@" & echo $! > "$0"; wait; exec sleep 600',
- str(stub_pid), binary, '--tui', '--9p=fresh'], env)
+ str(stub_pid), binary, '--tty', '--9p=fresh'], env)
started.append(shell.pid)
sock = root / 'pardes-9p-fresh.sock'
wait_for('the second session', sock.exists)
@@ -1425,7 +1425,7 @@ def upgrades(old, new):
started = []
try:
term = Term()
- stub = term.spawn([str(binary), '--tui', '--9p=work'], env)
+ stub = term.spawn([str(binary), '--tty', '--9p=work'], env)
started.append(stub.pid)
sock = root / 'pardes-9p-work.sock'
wait_for('the session\'s 9P socket', sock.exists)
@@ -1610,7 +1610,7 @@ def upgrades(old, new):
time.sleep(.3)
assert alive(shell_pid) and alive(daemon)
term = Term()
- stub = term.spawn([str(binary), '--tui', '--9p=again'], env)
+ stub = term.spawn([str(binary), '--tty', '--9p=again'], env)
started.append(stub.pid)
sock = root / 'pardes-9p-again.sock'
wait_for('the next session', sock.exists)
diff --git a/test/e2e_harness.zig b/test/e2e_harness.zig
index 6d0a43ca..410c33ae 100644
--- a/test/e2e_harness.zig
+++ b/test/e2e_harness.zig
@@ -91,7 +91,7 @@ pub const Harness = struct {
return initArgs(gpa, exe, rows, cols, null);
}
- /// Like init, but passes one extra CLI arg to the app (e.g. "--tui").
+ /// Like init, but passes one extra CLI arg to the app (e.g. "--tty").
pub fn initArgs(gpa: std.mem.Allocator, exe: [*:0]const u8, rows: u16, cols: u16, arg: ?[*:0]const u8) !Harness {
var argv: [2]?[*:0]const u8 = .{ null, null };
if (arg) |a| argv[0] = a;
diff --git a/test/fs.py b/test/fs.py
index f36f1039..a2b67cbc 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -45,7 +45,7 @@ def session(binary, root, name, *options, socket_name=None, file=None, tty=False
master, slave = os.openpty()
fcntl.ioctl(slave, termios.TIOCSWINSZ, struct.pack('HHHH', 24, 80, 0, 0))
env['TERM'] = 'xterm-256color'
- args = [binary, '--tui', '--9p=' + (socket_name or name), *options, str(file or fixture)]
+ args = [binary, '--tty', '--9p=' + (socket_name or name), *options, str(file or fixture)]
preexec = lambda: fcntl.ioctl(0, termios.TIOCSCTTY, 0)
if launch is not None:
args = [binary, *launch]
diff --git a/test/process.zig b/test/process.zig
index 94dfd313..bba795de 100644
--- a/test/process.zig
+++ b/test/process.zig
@@ -513,7 +513,7 @@ pub fn of(gpa: std.mem.Allocator, h: *const eh.Harness) Files {
pub const Backend = enum { tui, gui };
pub var backend: Backend = .tui;
-/// A case about one frontend's own behaviour (`--tui`, a killed terminal
+/// A case about one frontend's own behaviour (`--tty`, a killed terminal
/// editor) skips on the other.
pub fn only(b: Backend) !void {
if (backend != b) return error.SkipZigTest;
@@ -726,14 +726,14 @@ pub const Detached = struct {
}
/// Another session in this root, in a pty, as fs.py's tui sessions:
- /// `pardes --tui --9p=<name> <args> <root>/<name>.txt` (holding
+ /// `pardes --tty --9p=<name> <args> <root>/<name>.txt` (holding
/// "initial\n"), back once its socket (`abs("pardes-9p-<name>.sock")`)
/// is there.
- pub fn startTui(d: *Detached, exe: [:0]const u8, name: []const u8, args: []const [:0]const u8) !Child {
+ pub fn startTty(d: *Detached, exe: [:0]const u8, name: []const u8, args: []const [:0]const u8) !Child {
const a = d.files.arena.allocator();
try d.put(try std.fmt.allocPrint(a, "{s}.txt", .{name}), "initial\n");
var argv: std.ArrayList([:0]const u8) = .empty;
- try argv.appendSlice(a, &.{ exe, "--tui", try std.fmt.allocPrintSentinel(a, "--9p={s}", .{name}, 0) });
+ try argv.appendSlice(a, &.{ exe, "--tty", try std.fmt.allocPrintSentinel(a, "--9p={s}", .{name}, 0) });
try argv.appendSlice(a, args);
try argv.append(a, d.abs(try std.fmt.allocPrint(a, "{s}.txt", .{name})));
const env = try a.dupe([2][:0]const u8, &.{.{ "PARDES_DUMP", d.abs(try std.fmt.allocPrint(a, "{s}.dump.zon", .{name})) }});
diff --git a/test/process/builtins.zig b/test/process/builtins.zig
index 0d8ef5d4..410a3f54 100644
--- a/test/process/builtins.zig
+++ b/test/process/builtins.zig
@@ -11,16 +11,16 @@ pub const cases = .{
};
fn lspinfo(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
- for ([_]bool{ false, true }) |tui| {
+ for ([_]bool{ false, true }) |tty| {
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
const a = arena.allocator();
- const name = if (tui) "lsp-tui" else "lsp-detached";
- var d = try process.Detached.start(gpa, exe, if (tui) "lsp-root" else name, .{});
+ const name = if (tty) "lsp-tty" else "lsp-detached";
+ var d = try process.Detached.start(gpa, exe, if (tty) "lsp-root" else name, .{});
defer d.deinit();
var term: ?process.Child = null;
defer if (term) |*t| t.deinit();
- if (tui) term = try d.startTui(exe, name, &.{});
+ if (tty) term = try d.startTty(exe, name, &.{});
const address = d.abs(try std.fmt.allocPrint(a, "pardes-9p-{s}.sock", .{name}));
const c = try Conn.dial(gpa, address);
defer c.deinit(gpa);
diff --git a/test/process/flags.zig b/test/process/flags.zig
index 78be22f6..e8f30504 100644
--- a/test/process/flags.zig
+++ b/test/process/flags.zig
@@ -169,7 +169,7 @@ fn forwarding(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
.{ "/virtual/pane/1/body:1:2-4", "initial\n", .{ 1, 4 }, true },
}) |row| {
const before = try c.serials(a);
- const r = try process.run(a, &.{ exe, "--tui", row[0] }, opts);
+ const r = try process.run(a, &.{ exe, "--tty", row[0] }, opts);
try check(r.code == 0, "{s}: exit {d}: {s}", .{ row[0], r.code, r.said });
if (row[3]) {
try check(same(before, try c.serials(a)), "{s} made a pane", .{row[0]});
@@ -213,16 +213,15 @@ fn forwarding(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// Flags of a session's own start one, never forwarded.
const Launch = struct { []const u8, []const [:0]const u8, ?[]const u8 };
for ([_]Launch{
- .{ "mount", &.{ "--tui", z(a, "--mount=peer={s}", .{address}), "/n/peer/pane/1/body" }, null },
- .{ "name", &.{ "--tui", "--9p=forwarded-name" }, "forwarded-name" },
+ .{ "mount", &.{ "--tty", z(a, "--mount=peer={s}", .{address}), "/n/peer/pane/1/body" }, null },
+ .{ "name", &.{ "--tty", "--9p=forwarded-name" }, "forwarded-name" },
// --tty, the old spelling, which an upgraded session may pass.
- .{ "old-flag", &.{ "--tty", "--9p=old-flag" }, "old-flag" },
- .{ "tcp", &.{ "--tui", "--9p-tcp=tcp!127.0.0.1!0" }, null },
- .{ "load", &.{ "--tui", "-l", saved }, null },
+ .{ "tcp", &.{ "--tty", "--9p-tcp=tcp!127.0.0.1!0" }, null },
+ .{ "load", &.{ "--tty", "-l", saved }, null },
.{ "shells", &.{ "-n", "3" }, null },
- .{ "toggle", &.{ "--tui", "--tty-toggle=q" }, null },
- .{ "toggle-arg", &.{ "--tui", "--tty-toggle", "q" }, null },
- .{ "quic", &.{ "--tui", "--9p-quic=quic!127.0.0.1!0" }, null },
+ .{ "toggle", &.{ "--tty", "--tty-toggle=q" }, null },
+ .{ "toggle-arg", &.{ "--tty", "--tty-toggle", "q" }, null },
+ .{ "quic", &.{ "--tty", "--9p-quic=quic!127.0.0.1!0" }, null },
}) |row| {
if (std.mem.eql(u8, row[0], "quic") and !try process.quicIncluded(a, exe)) continue;
var argv: [8][:0]const u8 = undefined;
@@ -260,7 +259,7 @@ fn forwarding(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// A session that answers takes the file or says why, as acme's B does:
// a pane it has not is its refusal and exit 1, never a nested editor.
- const gone = try process.run(a, &.{ exe, "--tui", spaced }, .{ .root = d.root(), .env = &.{ inherited[0], .{ "PARDES_PANE", "4294967295" }, inherited[2] } });
+ const gone = try process.run(a, &.{ exe, "--tty", spaced }, .{ .root = d.root(), .env = &.{ inherited[0], .{ "PARDES_PANE", "4294967295" }, inherited[2] } });
try check(gone.code == 1 and std.mem.startsWith(u8, gone.said, "pardes: "), "gone pane: exit {d}: {s}", .{ gone.code, gone.said });
try std.testing.expectEqualStrings(before, try c.read(a, "/index"));
const absent = d.abs("absent.sock");
@@ -274,7 +273,7 @@ fn forwarding(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
.{ "not-nested", inherited[0..2], spaced },
}) |row| {
const existing = try process.entries(a, d.root());
- var argv: [3][:0]const u8 = .{ exe, "--tui", undefined };
+ var argv: [3][:0]const u8 = .{ exe, "--tty", undefined };
if (row[2]) |w| argv[2] = w;
var child = try Child.spawn(argv[0..if (row[2] != null) 3 else 2], .{ .root = d.root(), .env = row[1], .pty = .{ .log = d.abs(try std.fmt.allocPrint(a, "{s}.pty", .{row[0]})) } });
defer child.deinit();
@@ -680,7 +679,7 @@ fn outside(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
}
// A launch with no terminal to draw on (a pty that is no one's
// controlling terminal) says so and exits 1, no error trace.
- var tty = try Child.spawn(&.{ exe, "--tui", "x.txt" }, .{ .root = d.root(), .pty = .{ .log = d.abs("noctty.pty"), .ctty = false } });
+ var tty = try Child.spawn(&.{ exe, "--tty", "x.txt" }, .{ .root = d.root(), .pty = .{ .log = d.abs("noctty.pty"), .ctty = false } });
defer tty.deinit();
const words = try tty.said(a);
try exitsWith(&tty, 1, 10_000);
@@ -720,7 +719,7 @@ fn killedTty(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
const existing = try process.entries(a, d.root());
const log = d.abs(try std.fmt.allocPrint(a, "killed-{t}.pty", .{sig}));
// The daemon's, as a user's editor has: a hangup leaves the session.
- var killed = try Child.spawn(&.{ exe, "--tui", "x.txt" }, .{ .root = d.root(), .env = &.{.{ "PARDES_DAEMON", "on" }}, .pty = .{ .log = log } });
+ var killed = try Child.spawn(&.{ exe, "--tty", "x.txt" }, .{ .root = d.root(), .env = &.{.{ "PARDES_DAEMON", "on" }}, .pty = .{ .log = log } });
defer killed.deinit();
const deadline = process.nowMs() + 10_000;
while (!has(d.get(a, std.fs.path.basename(log)) catch "", "\x1b[?1049h")) {
diff --git a/test/process/mounts.zig b/test/process/mounts.zig
index f59a7a0f..10dc7b5a 100644
--- a/test/process/mounts.zig
+++ b/test/process/mounts.zig
@@ -129,7 +129,7 @@ fn quic(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
std.debug.print("SKIP a build without QUIC (-Dquic=true)\n", .{});
return;
}
- for ([_]bool{ false, true }) |tui| for ([_][:0]const u8{ "127.0.0.1", "::1" }) |host| {
+ for ([_]bool{ false, true }) |tty| for ([_][:0]const u8{ "127.0.0.1", "::1" }) |host| {
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
const a = arena.allocator();
@@ -137,11 +137,11 @@ fn quic(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try std.fmt.allocPrintSentinel(a, "--9p-tcp=tcp!{s}!0", .{host}, 0),
try std.fmt.allocPrintSentinel(a, "--9p-quic=quic!{s}!0", .{host}, 0),
};
- var d = try Detached.start(gpa, exe, if (tui) "quic-root" else "server", .{ .args = if (tui) &.{} else &args });
+ var d = try Detached.start(gpa, exe, if (tty) "quic-root" else "server", .{ .args = if (tty) &.{} else &args });
defer d.deinit();
var term: ?process.Child = null;
defer if (term) |*t| t.deinit();
- if (tui) term = try d.startTui(exe, "server", &args);
+ if (tty) term = try d.startTty(exe, "server", &args);
const address = d.abs("pardes-9p-server.sock");
const unix = try Conn.dial(gpa, address);
defer unix.deinit(gpa);
diff --git a/test/process/root_ctl.zig b/test/process/root_ctl.zig
index f4a0149b..e3420ac5 100644
--- a/test/process/root_ctl.zig
+++ b/test/process/root_ctl.zig
@@ -118,16 +118,16 @@ fn redial(gpa: std.mem.Allocator, path: []const u8) !*Conn {
}
fn restore(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
- for ([_]bool{ false, true }) |tui| {
+ for ([_]bool{ false, true }) |tty| {
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
const a = arena.allocator();
- const name = if (tui) "restore tui space" else "restore detached space";
- var d = try process.Detached.start(gpa, exe, if (tui) "restore-root" else name, .{});
+ const name = if (tty) "restore tty space" else "restore detached space";
+ var d = try process.Detached.start(gpa, exe, if (tty) "restore-root" else name, .{});
defer d.deinit();
var term: ?process.Child = null;
defer if (term) |*t| t.deinit();
- if (tui) term = try d.startTui(exe, name, &.{});
+ if (tty) term = try d.startTty(exe, name, &.{});
const address = d.abs(try std.fmt.allocPrint(a, "pardes-9p-{s}.sock", .{name}));
const old = try Conn.dial(gpa, address);
defer old.deinit(gpa);
@@ -179,7 +179,7 @@ fn restore(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
defer screen.deinit();
const width = try std.unicode.utf8CountCodepoints(std.mem.sliceTo(try screen.screen(), '\n'));
// A detached one is 160x50; a window keeps its own size.
- if (process.backend == .tui) try std.testing.expectEqual(@as(usize, if (tui) 80 else 160), width);
+ if (process.backend == .tui) try std.testing.expectEqual(@as(usize, if (tty) 80 else 160), width);
const opened = try restored.look(a, try std.fmt.allocPrint(a, "/n/own/os{s}", .{d.abs(try std.fmt.allocPrint(a, "{s}.txt", .{name}))}), ids[1]);
try std.testing.expectEqualStrings("initial\n", try restored.pane(a, opened, "body"));
}
diff --git a/test/selfmount.py b/test/selfmount.py
index 1df17226..61d32523 100644
--- a/test/selfmount.py
+++ b/test/selfmount.py
@@ -37,7 +37,7 @@ def unix_mount(ns, binary, served, env, name, fixture):
env = dict(env, PARDES_DUMP=f'/tmp/{second}.dump.zon')
pid, master = pty.fork()
if pid == 0:
- os.execve(ns, ['9ns', '--unix', served, '--', binary, '--tui', '--9p=' + second, str(fixture)], env)
+ os.execve(ns, ['9ns', '--unix', served, '--', binary, '--tty', '--9p=' + second, str(fixture)], env)
fcntl.ioctl(master, termios.TIOCSWINSZ, struct.pack('HHHH', 30, 100, 0, 0))
os.set_blocking(master, False)
try:
@@ -83,7 +83,7 @@ def run(binary):
env['PARDES_LSP_' + language] = ''
pid, master = pty.fork()
if pid == 0:
- os.execve(ns, ['9ns', '--mntgen', '--', binary, '--tui', '--9p=' + name, str(fixture)], env)
+ os.execve(ns, ['9ns', '--mntgen', '--', binary, '--tty', '--9p=' + name, str(fixture)], env)
fcntl.ioctl(master, termios.TIOCSWINSZ, struct.pack('HHHH', 30, 100, 0, 0))
os.set_blocking(master, False)
tail = bytearray()
@@ -276,7 +276,7 @@ def run(binary):
other_env = dict(env, PARDES_DUMP=f'/tmp/{other}.dump.zon')
other_pid, other_master = pty.fork()
if other_pid == 0:
- os.execve(binary, [binary, '--tui', '--9p=' + other], other_env)
+ os.execve(binary, [binary, '--tty', '--9p=' + other], other_env)
os.set_blocking(other_master, False)
deadline = time.monotonic() + 15
while not os.path.exists(other_sock) and time.monotonic() < deadline:
diff --git a/test/snapshots/ttyonly.snap b/test/snapshots/ttyonly.snap
index 0c2d8738..1008e084 100644
--- a/test/snapshots/ttyonly.snap
+++ b/test/snapshots/ttyonly.snap
@@ -1,6 +1,6 @@
-# --tui: a single fullscreen shell already in raw tty mode, prompts visible
+# --tty: a single fullscreen shell already in raw tty mode, prompts visible
file t.txt x
-start 31 100 --tui
+start 31 100 --tty
wait 8000 $
stable 700 20000
text echo TTY''ONLY