diff options
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/main.zig b/src/main.zig index a07991f5..16675265 100644 --- a/src/main.zig +++ b/src/main.zig @@ -76,7 +76,8 @@ const help_text = \\terminal's PAGER), else a new editor's. \\ \\Options: - \\ --tty start as one shell pane already in tty mode + \\ --tui start as one shell pane already in tty mode + \\ (--tty, its old spelling, too) \\ -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 @@ -395,7 +396,7 @@ fn webMain() !void { try @import("gui/gui.zig").run(.{}, .{}, false); } -// init.gpa, what the tty, gui and detached shells allocate from, is their +// init.gpa, what the tui, gui and detached shells allocate from, is their // own fixed arena (memory.host) in a release build, spilling to libc's // malloc, and std.start's DebugAllocator in Debug. Zig 0.17's std.start // gives a safe build a SafeAllocator over the page allocator instead. @@ -420,7 +421,7 @@ fn nativeMain(std_init: std.process.Init) !void { // An upgraded session's new process (upgrade.zig): its record, then the // arguments it was started with, which configure it as before; its // file, stdin, directory and daemon come from the record instead. - const upgraded = comptime upgrade.supported and (pardes.platform == .tty or pardes.platform == .gui); + const upgraded = comptime upgrade.supported and (pardes.platform == .tui or pardes.platform == .gui); if (upgraded) if (args.len > 1 and std.mem.startsWith(u8, args[1], upgrade.flag)) { upgrade.resumed = upgrade.Record.decode(args[1][upgrade.flag.len..]) catch badArgs(init.io, "--upgraded: a record this build cannot read", .{}); }; @@ -435,7 +436,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, "--tty")) { + if (std.mem.eql(u8, a, "--tui") or std.mem.eql(u8, a, "--tty")) { explicit_tty = true; } else if (std.mem.startsWith(u8, a, "--tty-toggle=")) { session_only = false; @@ -831,7 +832,7 @@ fn nativeMain(std_init: std.process.Init) !void { opts.rows = 50; } const kind: daemon.Kind = if (pardes.platform == .gui) .gui else .tty; - var term: @import("tty/tty.zig").Term = if (detach != null) .none else .open; + var term: @import("tui/tui.zig").Term = if (detach != null) .none else .open; var headless = detach != null; upgrade.remember(args); if (upgrade.resumed) |*rec| { @@ -847,7 +848,7 @@ fn nativeMain(std_init: std.process.Init) !void { } else if (daemon.wanted()) { if (detach != null or pardes.platform == .gui) { _ = daemon.register(null, kind, opts.ninep_name, detach != null); - } else if (pardes.platform == .tty) fork: { + } else if (pardes.platform == .tui) fork: { // A terminal's session is forked off its stub, which stays the // job the shell waits on: Detach (or the terminal's end) ends // the job and leaves the session running (daemon.forkSession). @@ -877,7 +878,7 @@ fn nativeMain(std_init: std.process.Init) !void { defer daemon.quit(); errdefer daemon.tellStubExit(1); switch (pardes.platform) { - .tty => @import("tty/tty.zig").run(init, opts, term) catch |err| switch (err) { + .tui => @import("tui/tui.zig").run(init, opts, term) catch |err| switch (err) { // No controlling terminal (a detached pty, a daemon): said, not // an error trace. error.NoDevice => { @@ -992,23 +993,23 @@ fn commOf(pid: []const u8, buf: *[64]u8) []const u8 { return std.mem.trimEnd(u8, buf[0..@intCast(got)], "\n"); } -/// The replica client of this build's frontend: a terminal's (tty.zig) or a +/// The replica client of this build's frontend: a terminal's (tui.zig) or a /// window's (gui.zig). fn clientOf(init: std.process.Init, opts: pardes.Options, path: []const u8, name: []const u8, far: bool) !void { switch (pardes.platform) { - .tty => try @import("tty/tty.zig").remote(init, opts, path, name, far), + .tui => try @import("tui/tui.zig").remote(init, opts, path, name, far), .gui => try @import("gui/gui.zig").remote(init, opts, path, name, far), else => unreachable, } } /// `pardes --attach=<where>:<name>` (`pardes-gui` too): a replica client -/// (tty.zig and gui.zig `remote`), through the socket `where` names, or +/// (tui.zig and gui.zig `remote`), through the socket `where` names, or /// through `ssh -L` of host `where`'s replica socket to one of this /// process's. fn remoteAttach(init: std.process.Init, opts: pardes.Options, where: []const u8, name: []const u8) noreturn { const io = init.io; - if (comptime pardes.platform != .tty and pardes.platform != .gui) unreachable; + if (comptime pardes.platform != .tui and pardes.platform != .gui) unreachable; const Say = struct { fn no(o: std.Io, comptime fmt: []const u8, args: anytype) noreturn { var buf: [700]u8 = undefined; @@ -1189,9 +1190,9 @@ test { _ = @import("file_watch.zig"); _ = @import("lsp/lsp_client.zig"); _ = @import("lsp/lsp.zig"); - if (comptime pardes.platform == .tty) { - _ = @import("tty/tty.zig"); - _ = @import("tty/panel_compositor.zig"); + if (comptime pardes.platform == .tui) { + _ = @import("tui/tui.zig"); + _ = @import("tui/panel_compositor.zig"); } if (comptime pardes.platform == .gui) _ = @import("gui/gui.zig"); if (comptime pardes.font_picker) _ = @import("fonts.zig"); |
