diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 20:54:21 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-04 21:12:33 -0300 |
| commit | 0ff1fc99eb870f8a1e714a71c1a853066737c822 (patch) | |
| tree | 2c8b4720e2ed190e6f9062cfe8586c3da22aeb42 /src | |
| parent | 3b082687c7da1c5d8cc52c71fdf4ddd38d860cd8 (diff) | |
| download | pardes-0ff1fc99eb870f8a1e714a71c1a853066737c822.tar.gz pardes-0ff1fc99eb870f8a1e714a71c1a853066737c822.zip | |
rename: the terminal frontend is the tui (-Dplatform=tui, src/tui/tui.zig, --tui with --tty kept as its old spelling, the process tests' backend .tui and --backend=tui, docs/typ/builtins-tui.json, the Settings report's platform), and the builtin Tty is Term (its registry entry, SPC n t, every default tag, the docs, tests and snap scripts), Tty still run as Term through exec.acme_words, Tty+fish too on a tag and a ctl; tty as a pane's raw mode and as the OS's terminal unchanged
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src')
36 files changed, 201 insertions, 176 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index dc50b85c..55253f02 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -23,7 +23,7 @@ pub const frontend: config.Runtime.Capabilities = .{ .scene_shaders = pardes.platform == .gui or pardes.platform == .macos, // The tty's font belongs to its emulator, and the P4 firmware's belongs to // whatever terminal is on the other end of the serial line. - .tagline_font_size = pardes.platform != .tty and pardes.platform != .esp32p4, + .tagline_font_size = pardes.platform != .tui and pardes.platform != .esp32p4, .window_opacity = pardes.platform == .gui or pardes.platform == .macos, .window_blur = pardes.platform == .macos, // Only the SDL shell shapes with HarfBuzz and honours the setting. macOS @@ -37,7 +37,7 @@ pub const frontend: config.Runtime.Capabilities = .{ /// GUI replica notes"): each has the other's words, which a view takes as /// its own frontend does (`viewCapabilities`), so a terminal's replica of a /// window's session steps as the window's own does, and back. -pub const desktop = pardes.platform == .tty or pardes.platform == .gui; +pub const desktop = pardes.platform == .tui or pardes.platform == .gui; const window_capabilities: config.Runtime.Capabilities = .{ .font_picker = true, .panel_transitions = true, .scene_shaders = true, .tagline_font_size = true, .window_opacity = true, .window_blur = false, .ligatures = true, .lift = true }; const terminal_capabilities: config.Runtime.Capabilities = .{ .font_picker = false, .panel_transitions = true, .scene_shaders = false, .tagline_font_size = false, .window_opacity = false, .window_blur = false, .ligatures = false, .lift = false }; @@ -54,7 +54,7 @@ pub fn viewCapabilities(p: *const Pardes) config.Runtime.Capabilities { /// The live view's frontend, by name (the Settings report's platform). pub fn viewPlatform(p: *const Pardes) []const u8 { if (comptime !desktop) return @tagName(pardes.platform); - return if (p.windowed) "gui" else "tty"; + return if (p.windowed) "gui" else "tui"; } /// Where a builtin acts: at the pane it runs from, or on the editor as a @@ -225,7 +225,7 @@ pub const registry = struct { } /// Whether the word takes its argument joined by a `+` as one word a - /// tag can hold and a click take whole (`Tty+fish`). Only a builtin + /// tag can hold and a click take whole (`Term+fish`). Only a builtin /// that says `pub const plus_arg = true;`: others have arguments a `+` /// may be in (`Dump+2024.zon` is a name, not Dump's argument). pub fn plusArg(b: Builtin()) bool { @@ -1465,8 +1465,8 @@ pub const DelBelow = struct { /// A shell in the calling pane's directory, raw from the first frame. On every /// pane's tagline: the fast path from wherever you are to a prompt there. /// A terminal below the caller in its directory: the configured shell, or -/// the one named, `Tty fish`, as a terminal's own tag word `Tty+fish` says. -pub const Tty = struct { +/// the one named, `Term fish`, as a terminal's own tag word `Term+fish` says. +pub const Term = struct { pub const takes_arg = true; pub const plus_arg = true; pub fn run(c: Ctx) void { @@ -1478,7 +1478,7 @@ pub const Tty = struct { // The authority's lookup, taped, as Shell's (exec.zig). if (pardes.tape.value(.shell, @import("host_io.zig").Shell.refusal, .{ arg[0..@min(arg.len, 200)], &why })) |refused| { var said: [340]u8 = undefined; - return c.p.reportFailure(c.id, std.fmt.bufPrint(&said, "Tty: {s}", .{refused}) catch "Tty: no such shell"); + return c.p.reportFailure(c.id, std.fmt.bufPrint(&said, "Term: {s}", .{refused}) catch "Term: no such shell"); } }; const pane = exec.spawnTty(c.p, c.id) orelse return; diff --git a/src/builtins_json.zig b/src/builtins_json.zig index 3402b2ee..f5543dba 100644 --- a/src/builtins_json.zig +++ b/src/builtins_json.zig @@ -1,4 +1,4 @@ -//! Every builtin as JSON, for the docs' glossary (docs/typ/builtins-tty.json +//! Every builtin as JSON, for the docs' glossary (docs/typ/builtins-tui.json //! and builtins-gui.json, a build's list each; style.typ merges them): //! the rows the `Help` builtin draws (pardes.builtin_rows: the leader path //! and the other shortcuts) with what /commands says of each word (its doc @@ -24,7 +24,7 @@ pub fn write(w: *std.Io.Writer) !void { var len: usize = 0; // This build's own frontend's words (a desktop build has the other's // too, which a view of its kind takes: builtins.zig `here`). - for (pardes.builtin_rows, 0..) |row, i| if (pardes.builtins.registry.hereFor(row.cmd, pardes.builtins.frontend, pardes.platform != .tty)) { + for (pardes.builtin_rows, 0..) |row, i| if (pardes.builtins.registry.hereFor(row.cmd, pardes.builtins.frontend, pardes.platform != .tui)) { all[len] = .{ .name = @tagName(row.cmd), .row = i }; len += 1; }; @@ -77,7 +77,7 @@ test "docs/typ/builtins-<platform>.json is what the registry says now" { // Linux builds' lists if (comptime @import("builtin").os.tag != .linux) return error.SkipZigTest; const file = switch (pardes.platform) { - .tty => "builtins-tty.json", + .tui => "builtins-tui.json", .gui => "builtins-gui.json", else => return error.SkipZigTest, }; diff --git a/src/colors.zig b/src/colors.zig index cc417ccb..141e0b0e 100644 --- a/src/colors.zig +++ b/src/colors.zig @@ -331,7 +331,7 @@ pub const Theme = struct { // editor palettes keep working; ChromeTheme resolves their legacy defaults. tag_active_bg: ?[3]u8 = null, tag_active_fg: ?[3]u8 = null, - /// Filename/output-name accent, also used by the Tty command. + /// Filename/output-name accent, also used by the Term command. tag_name_fg: ?[3]u8 = null, /// Active tint; absence preserves the shared name tint or active tag ink. tag_active_name_fg: ?[3]u8 = null, diff --git a/src/config.zig b/src/config.zig index 603e51f2..4f2802cc 100644 --- a/src/config.zig +++ b/src/config.zig @@ -100,7 +100,7 @@ pub const leader_path = paths: { .ClipReplace = "R", .Save = "fs", .New = "fn", - .Tty = "nt", + .Term = "nt", .Find = "ff", .Recent = "fr", .Grep = "fg", @@ -341,23 +341,23 @@ pub const child_term_program = "pardes"; pub const topbar_str = "Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit"; -pub const pane_builtins_str = "Tty Collapse Del"; -pub const pdf_pane_builtins_str = "Tty PdfSections PdfTint PdfFit Collapse Del"; -pub const file_pane_builtins_str = "Save Tty Collapse Del"; +pub const pane_builtins_str = "Term Collapse Del"; +pub const pdf_pane_builtins_str = "Term PdfSections PdfTint PdfFit Collapse Del"; +pub const file_pane_builtins_str = "Save Term Collapse Del"; /// After a file's, on one a language server speaks for. pub const lsp_pane_builtins_str = "Def Refs"; /// A diff's (a .diff, a .patch, a +Pager holding one): Diff. -pub const diff_pane_builtins_str = "Save Tty Diff Collapse Del"; +pub const diff_pane_builtins_str = "Save Term Diff Collapse Del"; /// A +Pager's (`pardes -`): Filter, as a terminal's. -pub const pager_pane_builtins_str = "Save Tty Filter Collapse Del"; +pub const pager_pane_builtins_str = "Save Term Filter Collapse Del"; /// A +Pager holding a diff (`git show`): Diff too. -pub const pager_diff_pane_builtins_str = "Save Tty Filter Diff Collapse Del"; +pub const pager_diff_pane_builtins_str = "Save Term Filter Diff Collapse Del"; /// A +Diff's: Diff again, the diff it stacks as text. -pub const diff_view_builtins_str = "Save Tty Diff Collapse Del"; -pub const terminal_pane_builtins_str = "Tty Save Mode Filter Collapse Del"; +pub const diff_view_builtins_str = "Save Term Diff Collapse Del"; +pub const terminal_pane_builtins_str = "Term Save Mode Filter Collapse Del"; pub const command_pane_builtins_str = "Kill Save Collapse Del"; /// A directory pane's (Dir.zig): Get reads it again, as acme's does. -pub const dir_pane_builtins_str = "Get Tty Collapse Del"; +pub const dir_pane_builtins_str = "Get Term Collapse Del"; // Each mode badge is one codepoint. pub const tag_normal = " "; @@ -1965,7 +1965,7 @@ pub const Runtime = struct { var defaults: Runtime = .{}; var defaults_context = context; defaults_context.startup_config_path = null; - defaults_context.platform = "tty"; + defaults_context.platform = "tui"; defaults_context.hover_delay_frames = null; defaults_context.native_images = false; defaults_context.capabilities = .{ @@ -2316,7 +2316,7 @@ test "docs/typ names only words, keys and default tags that exist" { var found: [3]std.ArrayList([]const u8) = @splat(.empty); // The arena's: gone with this test, so no later test reads it. defer doc_typ.other_build = ""; - for ([_][]const u8{ "builtins-tty.json", "builtins-gui.json" }) |f| { + for ([_][]const u8{ "builtins-tui.json", "builtins-gui.json" }) |f| { const text = dir.readFileAlloc(io, f, gpa, .limited(1 << 20)) catch continue; doc_typ.other_build = try std.mem.concat(gpa, u8, &.{ doc_typ.other_build, text }); } diff --git a/src/crash.zig b/src/crash.zig index a432fb87..054feda3 100644 --- a/src/crash.zig +++ b/src/crash.zig @@ -1,7 +1,7 @@ //! The crash file: what a panic leaves behind for the human who has to report it. //! //! stderr is where a panic has always gone, and stderr is the worst place this -//! program has. In the tty shell stderr IS the screen — the trace lands on the +//! program has. In the tui shell stderr IS the screen — the trace lands on the //! grid the terminal is being reset out of, and the next redraw or the next //! `clear` takes it with it. The GUI and the AppKit shells have no terminal at //! all, so it goes to a console nobody has open. A detached session's goes diff --git a/src/daemon.zig b/src/daemon.zig index 2a70c772..eb2b7eed 100644 --- a/src/daemon.zig +++ b/src/daemon.zig @@ -375,7 +375,7 @@ pub fn resumeLink(fd: c_int, stub_fd: c_int, k: Kind, named: []const u8, detache } pub const Note = union(enum) { - /// A terminal for a detached tty session (`pardes --attach`), and the + /// A terminal for a detached tui session (`pardes --attach`), and the /// stub's pipe; for a window session, both -1: open a window. attach: struct { tty: c_int, stub: c_int }, adopted: struct { pids: [max_fds]libc.pid_t, fds: [max_fds]c_int, n: usize }, diff --git a/src/detached/wire.zig b/src/detached/wire.zig index 337211b7..f73dee13 100644 --- a/src/detached/wire.zig +++ b/src/detached/wire.zig @@ -28,7 +28,7 @@ pub const version: u16 = 19; /// The terminal's build and the window's step alike (`semantics`). const family = switch (config.platform) { - .tty, .gui => "desktop", + .tui, .gui => "desktop", else => @tagName(config.platform), }; @@ -269,7 +269,7 @@ pub fn helloVersion(payload: []const u8) Error!u16 { } /// Frontend -> core, decoded. The `Event`'s slices BORROW the payload buffer, -/// exactly like the pty chunks the tty host hands to `update`: valid for that +/// exactly like the pty chunks the tui host hands to `update`: valid for that /// one call and no longer. pub const ClientMsg = union(enum) { hello: Hello, diff --git a/src/draw.zig b/src/draw.zig index 8503197c..4f238942 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -1057,7 +1057,7 @@ fn tagTintRange(pane: *const Pane, tag: []const u8, prefix_len: usize) ?struct { // `tag` is the first row; a prefix longer than it ran to a second. var words = std.mem.tokenizeAny(u8, tag[@min(prefix_len, tag.len)..], " \t\r\n"); while (words.next()) |word| { - if (!std.mem.eql(u8, word, "Tty") and !std.mem.startsWith(u8, word, "Tty+")) continue; + if (!std.mem.eql(u8, word, "Term") and !std.mem.startsWith(u8, word, "Term+")) continue; const lo = @intFromPtr(word.ptr) - @intFromPtr(tag.ptr); return .{ .lo = lo, .hi = lo + word.len }; } @@ -1513,12 +1513,12 @@ test "a grip's four states, focused or not and clean or dirty, are each its own pane.file.?.revision = pane.file.?.saved_revision; } -test "every theme draws a file's name, a +Errors and a Tty word in a tint, never the tag's plain ink" { +test "every theme draws a file's name, a +Errors and a Term word in a tint, never the tag's plain ink" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .cols = 120, .rows = 40, .tty_only = true }); defer p.deinit(); _ = try p.setTestFile("text\n"); - try std.testing.expect(p.executeBuiltinLine(0, "Tty+sh")); + try std.testing.expect(p.executeBuiltinLine(0, "Term+sh")); const terminal = p.active; p.acknowledgeShell(terminal, "/bin/sh", false); try @import("Output.zig").openErrors(p, 0, try gpa.dupe(u8, "oops\n")); @@ -1529,7 +1529,7 @@ test "every theme draws a file's name, a +Errors and a Tty word in a tint, never if (pane.file) |f| if (std.mem.endsWith(u8, f.path, "+Errors")) break id; } else return error.NoErrorsPane; const Probe = struct { id: usize, word: []const u8 }; - const probes = [_]Probe{ .{ .id = 0, .word = "test.txt" }, .{ .id = terminal, .word = "Tty+sh" }, .{ .id = errors, .word = "+Errors" } }; + const probes = [_]Probe{ .{ .id = 0, .word = "test.txt" }, .{ .id = terminal, .word = "Term+sh" }, .{ .id = errors, .word = "+Errors" } }; var arena: std.heap.ArenaAllocator = .init(gpa); defer arena.deinit(); for (pardes.themes, 0..) |theme, index| { diff --git a/src/dump.zig b/src/dump.zig index 5f5f5870..9ceaa600 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -403,7 +403,7 @@ fn loadAndRevive(gpa: std.mem.Allocator, opts: Options, bytes: []const u8, previ }; try reviveSession(p, previous, kept != null); // What another build's dump could not give, said where the user looks - // (stderr is a tty session's screen). + // (stderr is a tui session's screen). if (notes.items.len > 0) { const first = notes.items[0 .. std.mem.indexOfScalar(u8, notes.items, '\n') orelse notes.items.len]; var buf: [320]u8 = undefined; diff --git a/src/effect_sources.zig b/src/effect_sources.zig index f45bf293..36d62774 100644 --- a/src/effect_sources.zig +++ b/src/effect_sources.zig @@ -21,8 +21,8 @@ pub const Backend = @TypeOf(build_config.platform); pub const backend: Backend = build_config.platform; pub const files = switch (backend) { - .tty => [_]filesystem.Source{ - .{ .path = "src/tty/panel_compositor.zig", .contents = @embedFile("tty/panel_compositor.zig") }, + .tui => [_]filesystem.Source{ + .{ .path = "src/tui/panel_compositor.zig", .contents = @embedFile("tui/panel_compositor.zig") }, }, .gui => [_]filesystem.Source{ .{ .path = "src/gui/gui.zig", .contents = @embedFile("gui/gui.zig") }, @@ -50,7 +50,7 @@ pub const files = switch (backend) { pub fn forSetting(setting: config.Runtime.Setting) ?[]const []const u8 { return switch (setting.action) { .transition => switch (backend) { - .tty => &.{ "src/layout.zig", "src/pardes.zig", "src/tty/panel_compositor.zig" }, + .tui => &.{ "src/layout.zig", "src/pardes.zig", "src/tui/panel_compositor.zig" }, .gui => &.{ "src/layout.zig", "src/pardes.zig", "src/gui/gui.zig", ui_vertex_path, ui_fragment_path, image_vertex_path, image_fragment_path }, .macos => &.{ "src/layout.zig", "src/pardes.zig", "src/macos/Sources/PardesView.swift", "src/macos/Sources/ScenePostprocessor.swift", "shaders/crt.ci.metal" }, .web, .esp32p4 => null, @@ -63,7 +63,7 @@ pub fn forSetting(setting: config.Runtime.Setting) ?[]const []const u8 { .grain => &.{ "src/gui/Post.zig", "src/gui/gui.zig", post_vertex_path, post_grain_path }, }, .macos => &.{ "src/macos/Sources/PardesView.swift", "src/macos/Sources/ScenePostprocessor.swift", "shaders/crt.ci.metal" }, - .tty, .web, .esp32p4 => null, + .tui, .web, .esp32p4 => null, }, else => null, }; @@ -73,7 +73,7 @@ test "EffectCode paths resolve uniquely to this backend's archived inputs" { if (!@import("memory.zig").limits.embedded_sources) return error.SkipZigTest; for (config.Runtime.settings) |setting| { const available = switch (setting.action) { - .transition => backend == .tty or backend == .gui or backend == .macos, + .transition => backend == .tui or backend == .gui or backend == .macos, .scene => backend == .gui or backend == .macos, else => false, }; @@ -94,7 +94,7 @@ test "EffectCode paths resolve uniquely to this backend's archived inputs" { }; try std.testing.expectEqual(@as(usize, 1), matches); } - try std.testing.expectEqual(backend == .tty, filesystem.sourceBytes("src/tty/panel_compositor.zig") != null); + try std.testing.expectEqual(backend == .tui, filesystem.sourceBytes("src/tui/panel_compositor.zig") != null); try std.testing.expectEqual(backend == .gui, filesystem.sourceBytes("src/gui/gui.zig") != null); try std.testing.expectEqual(backend == .macos, filesystem.sourceBytes("src/macos/Sources/PardesView.swift") != null); } diff --git a/src/esp32p4.zig b/src/esp32p4.zig index 683d19e1..074ca6b3 100644 --- a/src/esp32p4.zig +++ b/src/esp32p4.zig @@ -386,8 +386,8 @@ fn drainInput(c: *pardes.Pardes, force: bool) void { } else esc_held_at = null; } -/// One parsed vaxis event applied to the core. Mirrors the tty shell's `apply` -/// (`src/tty/tty.zig:926-985`), minus everything that needs an OS. +/// One parsed vaxis event applied to the core. Mirrors the tui shell's `apply` +/// (`src/tui/tui.zig:926-985`), minus everything that needs an OS. fn apply(c: *pardes.Pardes, ev: vaxis.Event) void { switch (ev) { .key_press => |key| if (in_paste) { @@ -466,7 +466,7 @@ fn apply(c: *pardes.Pardes, ev: vaxis.Event) void { } }, // The only way this platform learns its size, and the one place a 384 KiB heap shows through - // to the user. Two things happen here that the tty shell does not need. + // to the user. Two things happen here that the tui shell does not need. // // CLAMPED, because the grids do not fit an arbitrary terminal: vaxis keeps a `Screen` and an // `InternalScreen`, pardes keeps its own `Surface` and `previous_cells`, so every cell is @@ -595,9 +595,9 @@ fn gpioToggle(_: ?*anyopaque, pin: u16, was: *u8, now: *u8) bool { return f(out_ctx, pin, was, now); } -/// The canonical surface -> the wire. Same shape as the tty shell's (`src/tty/tty.zig:1096`) minus +/// The canonical surface -> the wire. Same shape as the tui shell's (`src/tui/tui.zig:1096`) minus /// the panel compositor and the kitty image path: neither has a reason to exist on a board with no -/// pixels. Where the tty shell hands every cell to vaxis and lets it diff, this diffs against the +/// pixels. Where the tui shell hands every cell to vaxis and lets it diff, this diffs against the /// Surface itself and can then emit the ANSI directly - see `direct_emit`. fn present(_: ?*anyopaque, surface: *const pardes.Surface) void { const t0 = cycles(); 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); } diff --git a/src/file_watch.zig b/src/file_watch.zig index f640fa5f..89d0fdaf 100644 --- a/src/file_watch.zig +++ b/src/file_watch.zig @@ -100,7 +100,7 @@ const wake_ident: usize = std.math.maxInt(usize); /// `polled` is the only flag that survives the port. On linux it adds /// IN_NONBLOCK, because a host that finds this descriptor ready in its own /// `poll(2)` must be able to stop draining it, while a -/// host that parks a thread in `wait` (tty.zig, gui.zig) wants the blocking +/// host that parks a thread in `wait` (tui.zig, gui.zig) wants the blocking /// read. On macos neither host needs either flag: a kqueue is not inherited /// across `fork(2)`, so there is no CLOEXEC to ask for, and whether a wait /// blocks is the timeout argument to `kevent(2)` rather than a property of the @@ -143,11 +143,11 @@ pub fn init(polled: bool) c_int { /// /// macos only, because it exists for the one thing a kqueue cannot do the way /// an inotify descriptor can — be read. The linux hosts keep reading theirs -/// (tty.zig through `std.Io.File`, so teardown's `cancel` interrupts it), and +/// (tui.zig through `std.Io.File`, so teardown's `cancel` interrupts it), and /// this is the shape that replaces that where there is nothing to read. /// /// Deliberately does NOT report WHAT changed, for the reason the watcher -/// threads in tty.zig and gui.zig already give: the loop re-reads every marked +/// threads in tui.zig and gui.zig already give: the loop re-reads every marked /// pane anyway. pub fn wait(fd: c_int) bool { if (comptime builtin.os.tag != .macos) return false; diff --git a/src/fonts.zig b/src/fonts.zig index 88cde63a..c4f96bad 100644 --- a/src/fonts.zig +++ b/src/fonts.zig @@ -7,7 +7,7 @@ //! //! It lives at src/ rather than under gui/ because two shells now draw their //! own text: builtins.zig imports it behind `platform == .gui or .macos`, so -//! the tty binary compiles not one line of this and never opens a font +//! the tui binary compiles not one line of this and never opens a font //! directory, and the browser (which has no font directories to open) is out //! for a better reason than taste. //! @@ -1098,7 +1098,7 @@ fn findEmbeddedSource(path: []const u8, allow_root_suffix: bool) ?Source { } pub const platform_has_fs = !pardes.isolated and switch (pardes.platform) { - .tty, .gui, .macos => true, + .tui, .gui, .macos => true, .web, .esp32p4 => false, }; diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 50baf9ec..15347eb6 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -2672,7 +2672,7 @@ const Client = struct { } /// Its own view drawn in the window, outside any step, as the tty's - /// client draws its terminal (tty.zig `Remote.draw`): what presenting + /// client draws its terminal (tui.zig `Remote.draw`): what presenting /// writes in the core (a frame skipped, one owed) is put back. fn draw(cl: *Client, s: *Shell) void { const r = cl.link.r; @@ -4205,10 +4205,10 @@ const Shell = struct { windowed: u8 = 1, /// This wait took only a replica's post (its input, its join): the pump /// after it reads no new time, so it moves nothing the replicas' - /// speculations stand on (tty.zig's `mail_only`). + /// speculations stand on (tui.zig's `mail_only`). mail_only: bool = false, waited: bool = false, - /// With replica clients, a wait takes one person's input (tty.zig + /// With replica clients, a wait takes one person's input (tui.zig /// `split`): the next is held for the next wait. took_input: bool = false, held: ?c.SDL_Event = null, @@ -4399,7 +4399,7 @@ const Shell = struct { } /// With replica clients, a wait takes one person's input and its pump - /// makes one unit of it (tty.zig `split`): whether `sev`, a second, is + /// makes one unit of it (tui.zig `split`): whether `sev`, a second, is /// held for the next wait. Any event but a wake is no replica's post. fn split(s: *Shell, sev: *const c.SDL_Event) bool { if (sev.type != c.SDL_EVENT_USER) s.mail_only = false; @@ -4574,7 +4574,7 @@ const Shell = struct { } /// One shell of a dead session (`pid` 0: the last of them was told): - /// a terminal pane made for it, as the Tty word makes one, whose spawn + /// a terminal pane made for it, as the Term word makes one, whose spawn /// takes this pty (spawnPane). fn adoptShell(s: *Shell, pid: libc.pid_t, fd: c_int) void { const core = s.core; diff --git a/src/host_io.zig b/src/host_io.zig index 3b91ea7e..5cdf6e0d 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -1456,7 +1456,7 @@ pub const Shell = struct { return true; } - /// Why `bin` is no shell, for the words that name one (Tty, Shell); + /// Why `bin` is no shell, for the words that name one (Term, Shell); /// null when it is one. pub fn refusal(bin: []const u8, said: []u8) ?[]const u8 { var buf: [std.fs.max_path_bytes]u8 = undefined; @@ -2003,7 +2003,7 @@ pub fn forkShell( }; var master: c_int = -1; var path_buf: [std.fs.max_path_bytes]u8 = undefined; - // A terminal opened on a shell of its own (`Tty fish`) runs that one, + // A terminal opened on a shell of its own (`Term fish`) runs that one, // copied: looking it up gives the turn up, and the pane may go. var own_buf: [256]u8 = undefined; var own: ?[]const u8 = null; @@ -2225,7 +2225,7 @@ pub fn marksPrompts(pid: libc.pid_t) bool { } /// The program `pid` runs, where the system says (an adopted shell's, for -/// its pane's Tty word); null elsewhere. +/// its pane's Term word); null elsewhere. pub fn processExe(pid: libc.pid_t, buf: []u8) ?[]const u8 { if (comptime builtin.os.tag == .freebsd) { const n = kernProc(pid, 12, buf) orelse return null; // KERN_PROC_PATHNAME diff --git a/src/lsp/lsp_client.zig b/src/lsp/lsp_client.zig index 5baf7129..cc92e00e 100644 --- a/src/lsp/lsp_client.zig +++ b/src/lsp/lsp_client.zig @@ -1546,7 +1546,7 @@ fn ensure(c: *Conn, io: std.Io, si: usize, arena: std.mem.Allocator, req: lsp.Re } if (pid == 0) { // Between fork and exec, in a process with threads: only async- - // signal-safe calls, no allocation, no locks. (Same rule as tty.zig's + // signal-safe calls, no allocation, no locks. (Same rule as tui.zig's // forkShell.) _ = libc.setsid(); // Ctrl-C in pardes's terminal is not the server's business @import("../host_io.zig").resetChildSignals(); 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"); diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig index 6f5bee23..0ee25345 100644 --- a/src/ninep/cols.zig +++ b/src/ninep/cols.zig @@ -150,7 +150,7 @@ pub fn released(p: *Pardes, serial: ?u32) void { } /// A column's ctl: the words that act on a column, as its tag's clicks do -- -/// Delcol, Joincol, New, Tty -- one a line, each run as from that tag. What +/// Delcol, Joincol, New, Term -- one a line, each run as from that tag. What /// they say is the session's in the log (`msg -`), not the focused pane's. pub fn writeCtl(p: *Pardes, req: Req, serial: u32) Reply { // What this write touched, alone, reads back (runBuiltin notes it). @@ -162,14 +162,14 @@ pub fn writeCtl(p: *Pardes, req: Req, serial: u32) Reply { const line = std.mem.trim(u8, raw, " \t\r"); if (line.len == 0 or pardes.exec.isComment(line)) continue; const word = line[0 .. std.mem.indexOfAny(u8, line, " \t") orelse line.len]; - const takes = for ([_][]const u8{ "Delcol", "Joincol", "New", "Tty" }) |w| { + const takes = for ([_][]const u8{ "Delcol", "Joincol", "New", "Term" }) |w| { if (std.mem.eql(u8, w, word)) break true; } else false; // Plan 9's words for it, so a mount's errno is EINVAL as the root's // and a pane's ctl give (9ns reads "control message"). - if (!takes) return tree.failText(req.tag, E.INVAL, std.fmt.bufPrint(&p.fs.ename, "unknown control message \"{s}\": a column's ctl takes Delcol, Joincol, New or Tty", .{pardes.ctlfs.ctl.firstWord(line)[0..@min(pardes.ctlfs.ctl.firstWord(line).len, 64)]}) catch "unknown control message"); - // Only Tty takes a word (its shell); `New extra` is no New. - if (!std.mem.eql(u8, word, "Tty") and word.len != line.len) + if (!takes) return tree.failText(req.tag, E.INVAL, std.fmt.bufPrint(&p.fs.ename, "unknown control message \"{s}\": a column's ctl takes Delcol, Joincol, New or Term", .{pardes.ctlfs.ctl.firstWord(line)[0..@min(pardes.ctlfs.ctl.firstWord(line).len, 64)]}) catch "unknown control message"); + // Only Term takes a word (its shell); `New extra` is no New. + if (!std.mem.eql(u8, word, "Term") and word.len != line.len) return tree.failText(req.tag, E.INVAL, std.fmt.bufPrint(&p.fs.ename, "wrong #args in control message \"{s}\"", .{pardes.ctlfs.ctl.firstWord(line)[0..@min(pardes.ctlfs.ctl.firstWord(line).len, 64)]}) catch "wrong #args in control message"); const col = layout.columnBySerial(p, serial) orelse return Reply.fail(req.tag, E.NOENT); p.exec_column = col; @@ -197,7 +197,7 @@ pub fn writeExec(p: *Pardes, req: Req, serial: ?u32) Reply { if (pardes.ctlfs.ctl.tooLong(req, line)) |refusal| return refusal; // A pane's word (Undo, Msg, Save) is no word of a tag no pane owns: // refused as the root's ctl refuses it, never done at whichever - // pane has the keyboard. The tag's own words (New, Tty, Find, Grep + // pane has the keyboard. The tag's own words (New, Term, Find, Grep // in a column's) are its to run. if (paneWord(line, if (serial == null) pardes.config.topbar_str else tagline.column_tag_default)) return pardes.ctlfs.ctl.refuseTo(p, req, "not a session control message", line, "pane/<n>/ctl"); @@ -380,7 +380,7 @@ fn paneWord(line: []const u8, own: []const u8) bool { const b = std.meta.stringToEnum(pardes.builtins.registry.Builtin(), word) orelse return false; if (pardes.builtins.registry.scope(b) == .session) return false; // A new pane is every tag's to make, in the session's directory. - if (b == .New or b == .Tty) return false; + if (b == .New or b == .Term) return false; var words = std.mem.tokenizeScalar(u8, own, ' '); while (words.next()) |w| if (std.mem.eql(u8, w, word)) return false; return true; @@ -440,18 +440,18 @@ test "a shell command at /tagexec or a column's exec is a command pane in the se } } -test "New and Tty run at /tagexec and a column's exec, with no pane at all too" { +test "New and Term run at /tagexec and a column's exec, with no pane at all too" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); const tagexec = @backingInt(tree.TopFile.tagexec); const col_exec = tree.Node.ofCol(layout.columnSerial(p, 0), .exec); - for ([_]u64{ tagexec, col_exec }) |node| for ([_][]const u8{ "New\n", "Tty\n" }) |line| { + for ([_]u64{ tagexec, col_exec }) |node| for ([_][]const u8{ "New\n", "Term\n" }) |line| { const before = p.next_serial; try testing.expectEqual(tree.Status.ok, th.wr(p, node, line).reply.status); try testing.expectEqual(before + 1, p.next_serial); }; // Every pane gone: the workspace tag makes one all the same. - for ([_][]const u8{ "New\n", "Tty\n" }) |line| { + for ([_][]const u8{ "New\n", "Term\n" }) |line| { while (p.ncol > 0) { const first = p.panes[p.col_panes[0][0]].?.serial; _ = th.wr(p, tree.Node.of(first, .ctl), "delete\n"); @@ -475,7 +475,7 @@ test "every pane word a tag no pane owns does not hold is refused there, Edit in var checked: usize = 0; for (std.enums.values(Builtin)) |b| { if (pardes.builtins.registry.scope(b) == .session) continue; - if (b == .New or b == .Tty) continue; // every tag's + if (b == .New or b == .Term) continue; // every tag's var owned = false; var words = std.mem.tokenizeScalar(u8, tag_file.own, ' '); while (words.next()) |w| owned = owned or std.mem.eql(u8, w, @tagName(b)); @@ -548,7 +548,7 @@ test "a column's tag and the workspace's read, replace and append as a pane tag try testing.expectEqual(E.NOENT, th.look_up(p, col_dir, "777").errno()); const tag = Node.ofCol(serial, .tag); try testing.expectEqual(tree.Status.ok, th.look_up(p, Node.ofCol(serial, .dir), "tag").reply.status); - try testing.expectEqualStrings("New Tty Find Grep Joincol Delcol", th.rd(p, tag, 0, 4096).bytes); + try testing.expectEqualStrings("New Term Find Grep Joincol Delcol", th.rd(p, tag, 0, 4096).bytes); // `echo Make > tag`: cleared, then the newline ending the write dropped. _ = th.call(p, .{ .tag = 1, .op = .setattr, .node = tag, .truncate = true }); _ = th.wr(p, tag, "Make\n"); diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 89549933..4749fc94 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -515,9 +515,15 @@ fn blanked(line: []const u8, buf: []u8) []const u8 { /// as on a tag; acme's lowercase verbs are the pane ctl's and alias none. fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ?Reply { var sp = std.mem.indexOfAny(u8, line, " \t"); - // `Word+arg` for a word that takes one so (`Tty+bash`), as exec does. - if (sp == null) if (std.mem.indexOfScalar(u8, line, '+')) |at| if (std.meta.stringToEnum(Builtin, line[0..at])) |head| { - if (builtins.registry.plusArg(head)) sp = at; + // `Word+arg` for a word that takes one so (`Term+bash`), as exec does; + // an old name's too (`Tty+bash`). + if (sp == null) if (std.mem.indexOfScalar(u8, line, '+')) |at| { + const head = for (pardes.exec.acme_words) |w| { + if (std.mem.eql(u8, line[0..at], w.acme)) break w.pardes orelse ""; + } else line[0..at]; + if (std.meta.stringToEnum(Builtin, head)) |b| if (builtins.registry.plusArg(b)) { + sp = at; + }; }; const typed = line[0 .. sp orelse line.len]; // acme's words: checked as the pardes word they run as, or refused. @@ -592,7 +598,7 @@ pub fn runBuiltin(p: *Pardes, req: Req, id: usize, line: []const u8) ?Reply { p.fs.failure_len = 0; defer p.fs.no_prompt = false; // What a ctl write touched reads back from /look and /exec as a click's - // does (`run`), so a script that made a pane with `Tty` finds it there. + // does (`run`), so a script that made a pane with `Term` finds it there. const context = if (p.panes[id]) |pane| pane.serial else 0; const before = Serials.snapshot(p); _ = exec_line.executeBuiltinLine(p, id, line); @@ -1768,7 +1774,7 @@ test "DumpConfig's whole report writes back to the root ctl, line by line, with } else return error.NoDumpConfigPane; defer testing.allocator.free(report); // What this shell cannot show is a comment, never a value it refuses. - if (pardes.platform == .tty) try testing.expect(std.mem.indexOf(u8, report, "# GripWidth unsupported\n") != null); + if (pardes.platform == .tui) try testing.expect(std.mem.indexOf(u8, report, "# GripWidth unsupported\n") != null); var lines = std.mem.splitScalar(u8, report, '\n'); while (lines.next()) |line| { if (line.len == 0) continue; @@ -1967,7 +1973,7 @@ test "Mount dials its peer and fails, mounting nothing, when none answers; a loo try testing.expect(th.logHas(p, "look: /n/gone/f.txt: dial failed: no answer")); } -test "Tty in a directory that is not there fails and makes no pane; a shell that never started answers a run" { +test "Term in a directory that is not there fails and makes no pane; a shell that never started answers a run" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); const serial = serialOf(p); @@ -1981,15 +1987,15 @@ test "Tty in a directory that is not there fails and makes no pane; a shell that defer p.host = .{}; var count: usize = 0; for (p.panes) |slot| count += @intFromBool(slot != null); - const refused = wr(p, Node.of(serial, .ctl), "Tty\n"); + const refused = wr(p, Node.of(serial, .ctl), "Term\n"); try testing.expectEqual(E.NOENT, refused.errno()); - try testing.expectStringStartsWith(refused.reply.ename, "Tty: /tmp/pardes-no-such-dir-zz: no such directory"); + try testing.expectStringStartsWith(refused.reply.ename, "Term: /tmp/pardes-no-such-dir-zz: no such directory"); var after: usize = 0; for (p.panes) |slot| after += @intFromBool(slot != null); try testing.expectEqual(count, after); // A terminal whose shell the host could not start. _ = wr(p, Node.of(serial, .name), "/tmp/f.txt\n"); - try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .ctl), "Tty\n").reply.status); + try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .ctl), "Term\n").reply.status); const term = p.active; p.shellFailed(@intCast(term), error.FileNotFound); const run_node = Node.of(p.panes[term].?.serial, .pty_run); @@ -2066,7 +2072,7 @@ test "a terminal told the directory it already goes by logs no rename" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); _ = wr(p, Node.of(serialOf(p), .name), "/tmp/f.txt\n"); - try testing.expectEqual(Status.ok, wr(p, Node.of(serialOf(p), .ctl), "Tty\n").reply.status); + try testing.expectEqual(Status.ok, wr(p, Node.of(serialOf(p), .ctl), "Term\n").reply.status); p.update(.tick); // announced const term = p.active; // The host says where its shell started: where it was already named. @@ -2161,7 +2167,7 @@ test "pty/ctl exec in a directory that is gone fails ENOENT; a shell that cannot try testing.expectEqualStrings("shell: permission denied", p.fs.late_failure[0..p.fs.late_failure_len]); } -test "a script whose interpreter is not there: Tty refuses it up front, only an err logged, and pty/ctl exec keeps the running shell" { +test "a script whose interpreter is not there: Term refuses it up front, only an err logged, and pty/ctl exec keeps the running shell" { const p = try th.withTerm(testing.allocator); defer p.deinit(); const Starting = struct { @@ -2178,14 +2184,14 @@ test "a script whose interpreter is not there: Tty refuses it up front, only an const serial = serialOf(p); var count: usize = 0; for (p.panes) |slot| count += @intFromBool(slot != null); - const refused = wr(p, Node.of(serial, .ctl), try std.fmt.bufPrint(&line, "Tty {s}/bad\n", .{dir})); + const refused = wr(p, Node.of(serial, .ctl), try std.fmt.bufPrint(&line, "Term {s}/bad\n", .{dir})); try testing.expectEqual(E.NOENT, refused.errno()); - try testing.expectEqualStrings("Tty: interpreter /no/such/interp not found", refused.reply.ename); + try testing.expectEqualStrings("Term: interpreter /no/such/interp not found", refused.reply.ename); var after: usize = 0; for (p.panes) |slot| after += @intFromBool(slot != null); try testing.expectEqual(count, after); // The log gained the err and nothing else: no new, msg or del. - try testing.expect(th.logHas(p, "Tty: interpreter /no/such/interp not found\n")); + try testing.expect(th.logHas(p, "Term: interpreter /no/such/interp not found\n")); try testing.expect(!th.logHas(p, "\nmsg ")); try testing.expect(!th.logHas(p, "\ndel ")); // The shell to start again is that script: refused before the running @@ -2407,7 +2413,7 @@ test "a focus moved over 9P tells the programs that asked for focus reports, as const first = for (p.panes) |slot| { if (slot) |pane| if (pane.isTerminal()) break pane.serial; } else return error.NoShell; - try testing.expectEqual(Status.ok, wr(p, Node.of(first, .exec), "Tty\n").reply.status); + try testing.expectEqual(Status.ok, wr(p, Node.of(first, .exec), "Term\n").reply.status); var shells: [2]usize = undefined; var n: usize = 0; for (p.panes, 0..) |slot, id| if (slot) |pane| if (pane.isTerminal() and n < 2) { @@ -2536,11 +2542,11 @@ test "size is monotonic: growing is never refused, and a size once taken is take p.unattended = true; const root_ctl = @backingInt(tree.TopFile.ctl); const new = @backingInt(tree.TopFile.new); - // The dogfood's repro: Newcol, three pane/new, a Tty, then pane/new + // The dogfood's repro: Newcol, three pane/new, a Term, then pane/new // until a column has no room (ENOSPC). try testing.expectEqual(Status.ok, wr(p, root_ctl, "Newcol\n").reply.status); for (0..3) |_| try testing.expectEqual(Status.ok, call(p, .{ .tag = 1, .op = .open, .node = new }).reply.status); - try testing.expectEqual(Status.ok, wr(p, Node.of(p.panes[p.active].?.serial, .ctl), "Tty\n").reply.status); + try testing.expectEqual(Status.ok, wr(p, Node.of(p.panes[p.active].?.serial, .ctl), "Term\n").reply.status); p.sync(); while (call(p, .{ .tag = 1, .op = .open, .node = new }).reply.status == .ok) p.sync(); p.sync(); @@ -2875,12 +2881,15 @@ test "a body write to an image pane says its body takes none, not that terminals try testing.expectEqualStrings(pane_files.e_no_body, wr(p, Node.of(doc.serial, .body), "x").reply.ename); } -test "Tty+bash on a pane ctl is Tty with its argument, as exec and the tag take it" { +test "Term+bash on a pane ctl is Term with its argument, as exec and the tag take it" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const r = call(p, .{ .tag = 1, .op = .write, .node = Node.of(serialOf(p), .ctl), .data = "Tty+sh\n" }); - try testing.expectEqual(Status.ok, r.reply.status); - try testing.expect(r.spawned); + // Tty+sh too: Term's old name, as a saved tag holds it. + for ([_][]const u8{ "Term+sh\n", "Tty+sh\n" }) |data| { + const r = call(p, .{ .tag = 1, .op = .write, .node = Node.of(serialOf(p), .ctl), .data = data }); + try testing.expectEqual(Status.ok, r.reply.status); + try testing.expect(r.spawned); + } } test "a Rename that reaches other files previews them, says so, and is the pane a waiting write answers" { @@ -3003,7 +3012,7 @@ test "a command or a terminal refused for room is refused before anything is log defer p.deinit(); const exec = Node.of(serialOf(p), .exec); var buf: [32]u8 = undefined; - for ([_][]const u8{ "ls\n", "Tty\n" }) |line| { + for ([_][]const u8{ "ls\n", "Term\n" }) |line| { // Each a pane of its own until the column has no room for one more. var before = p.next_serial; var tries: usize = 0; diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 28f1882d..d0b368ea 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -883,7 +883,7 @@ fn nameFault(name: []const u8) ?[]const u8 { fn unnamed(pane: *const Pane) []const u8 { return if (pane.isTerminal()) - "invalid rename: a terminal is named by its shell's directory; cd there, or Tty in another" + "invalid rename: a terminal is named by its shell's directory; cd there, or Term in another" else "invalid rename: an image or PDF is named by the file it shows"; } diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig index ee8c618e..5c9a6289 100644 --- a/src/ninep/pty.zig +++ b/src/ninep/pty.zig @@ -76,7 +76,7 @@ pub fn writeCtl(p: *Pardes, req: Req, id: usize) Reply { if (!apply and std.mem.eql(u8, line, "exec")) if (p.panes[id]) |pane| if (pane.command != null) return tree.failText(req.tag, E.INVAL, "invalid exec: a command pane does not restart"); // A shell restarted where the directory is gone would not start: - // refused before anything runs, as Tty there is. + // refused before anything runs, as Term there is. if (!apply and std.mem.eql(u8, line, "exec")) if (p.panes[id]) |pane| if (pardes.exec.missingDir(p, pane.cwdSlice())) { const dir = pane.cwdSlice(); return tree.failText(req.tag, E.NOENT, std.fmt.bufPrint(&p.fs.ename, "exec: {s}: no such directory", .{dir[0..@min(dir.len, 256)]}) catch "exec: no such directory"); diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index 6bf14243..bd53b6a9 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -1843,7 +1843,7 @@ test "random placements, refused or not, leave no pane under its tag and two row 1 => _ = call(p, .{ .tag = 1, .op = .open, .node = @backingInt(TopFile.new) }), 2 => _ = th.wr(p, Node.of(at, .exec), "Newcol\n"), 3 => _ = th.wr(p, Node.of(at, .exec), "Edit =\n"), - 4 => _ = th.wr(p, Node.of(at, .exec), "Tty\n"), + 4 => _ = th.wr(p, Node.of(at, .exec), "Term\n"), 5 => _ = th.wr(p, Node.of(at, .look), looked), 6 => _ = th.wr(p, Node.of(at, .exec), "Delcol\n"), else => _ = th.wr(p, Node.of(at, .ctl), "delete\n"), @@ -2005,7 +2005,7 @@ test "look and exec read back what their own open's write touched; a fresh open const first = p.panes[0].?.serial; const mine = call(p, .{ .tag = 1, .op = .open, .node = exec, .omode = 2 }).reply.handle; const theirs = call(p, .{ .tag = 2, .op = .open, .node = exec, .omode = 2 }).reply.handle; - _ = call(p, .{ .tag = 3, .op = .write, .node = exec, .handle = mine, .data = "Tty\n" }); + _ = call(p, .{ .tag = 3, .op = .write, .node = exec, .handle = mine, .data = "Term\n" }); const made = p.panes[p.active].?.serial; try testing.expect(made != first); _ = call(p, .{ .tag = 4, .op = .write, .node = exec, .handle = theirs, .data = "Msg hi\n" }); diff --git a/src/panes.zig b/src/panes.zig index fd3cfab0..8a9b6aed 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -134,7 +134,7 @@ pub const Pane = struct { /// then /proc says this process's directory, not the shell's /// (Pardes.setCwd keeps the one it was started in). shell_spoke: bool = false, - /// A shell has run in it (Pardes.acknowledgeShell): a Tty whose first + /// A shell has run in it (Pardes.acknowledgeShell): a Term whose first /// shell fails to start closes, one started again keeps its pane. had_shell: bool = false, pending_command: terminal.PendingCommand = .{}, @@ -164,10 +164,10 @@ pub const Pane = struct { /// Its child pages as a terminal's does (`pardes -`, a +Pager), not /// through cat: Look's `git show` of a commit (look.lookCommit). command_pages: bool = false, - /// The shell a terminal runs when it is not the configured one (`Tty + /// The shell a terminal runs when it is not the configured one (`Term /// fish`), owned. shell: ?[]u8 = null, - /// An interactive terminal's tag text naming its shell, ` Tty+fish ...` + /// An interactive terminal's tag text naming its shell, ` Term+fish ...` /// (Pardes.acknowledgeShell); empty until the host says which it ran. shell_tail: [96]u8 = undefined, shell_tail_len: u8 = 0, diff --git a/src/pardes.zig b/src/pardes.zig index 4c1d0a10..89e99a9b 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -75,7 +75,7 @@ const host_io = @import("host_io.zig"); pub const Host = host_io.Host; pub const frameMark = tracy.frameMark; -pub const Platform = enum { tty, gui, web, macos, esp32p4 }; +pub const Platform = enum { tui, gui, web, macos, esp32p4 }; pub const platform: Platform = @field(Platform, @tagName(@import("pardes_config").platform)); pub const theme_animation = @import("pardes_config").theme_animation; @@ -87,7 +87,7 @@ pub const isolated = @import("pardes_isolation").isolated; pub const font_picker = platform == .gui or platform == .macos; -pub const hosted = platform == .tty or platform == .gui or platform == .macos; +pub const hosted = platform == .tui or platform == .gui or platform == .macos; /// Whose turn it is with the core. The core is single-threaded: the editor's /// thread has it, and lets go of it in two kinds of gap -- while it waits for @@ -174,7 +174,7 @@ pub const Turn = struct { pub fn yield(t: *Turn) void { // A replica makes no syscall: each is a site of the tape's. One that // is none stops a speculation and diverges a replay (it joins - // again), never the process (a window client's `Tty fish`, H17). + // again), never the process (a window client's `Term fish`, H17). if (tape.replaying()) tape.stray(); const io = t.io orelse return; yield_depth += 1; @@ -234,7 +234,7 @@ pub const Turn = struct { } }; -pub const can_attach = platform == .tty or platform == .gui; +pub const can_attach = platform == .tui or platform == .gui; pub const terminal_panes = platform != .esp32p4; @@ -253,7 +253,7 @@ pub const sdl_pdf_raster_policy: PdfRasterPolicy = .{ .match_viewport = true, }; pub const pdf_raster_policy: PdfRasterPolicy = switch (platform) { - .tty => kitty_pdf_raster_policy, + .tui => kitty_pdf_raster_policy, // Both pixel shells rasterize for a real display and can afford it; the // wire-bandwidth argument that shapes the Kitty policy does not apply. .gui, .macos => sdl_pdf_raster_policy, @@ -638,21 +638,21 @@ test "topbar hover highlights exactly the executable word" { try std.testing.expectEqual(Color{ .rgb = p.chromeTheme().tag_bg }, left.at(TAG_TEXT_INSET + 1, 0).style.bg); } -test "pane-tag Exec prefers Tty and argument builtins before shell fallback" { +test "pane-tag Exec prefers Term and argument builtins before shell fallback" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .cols = 100, .rows = 30 }); defer p.deinit(); while (p.nextEffect()) |_| {} // initial shell spawn/geometry p.acknowledgeShell(0, "/bin/sh", false); - // The Tty word names the shell the host ran, and opens another of it. + // The Term word names the shell the host ran, and opens another of it. const pane = p.panes[0].?; - try std.testing.expectEqualStrings(" Tty+sh" ++ tagline.terminal_pane_tail[" Tty".len..], tagline.curTail(pane)); + try std.testing.expectEqualStrings(" Term+sh" ++ tagline.terminal_pane_tail[" Term".len..], tagline.curTail(pane)); const tag_x = p.rects[0].x + TAG_TEXT_INSET; const tag_y = p.rects[0].y; const rendered = try tagline.tagText(p, p.scratch.allocator(), pane); - const new_x = tag_x + @as(u16, @intCast(std.mem.indexOf(u8, rendered, "Tty").?)) + 1; + const new_x = tag_x + @as(u16, @intCast(std.mem.indexOf(u8, rendered, "Term").?)) + 1; var panes_before: usize = 0; for (p.panes) |s| if (s != null) { panes_before += 1; @@ -914,14 +914,14 @@ test "compact tag commands stay beside their own prefix across layout changes" { try std.testing.expectEqualStrings(above_tag, try tagline.tagText(p, p.scratch.allocator(), above)); } -test "Tty spawns a raw shell in the caller's directory" { +test "Term spawns a raw shell in the caller's directory" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 100, .rows = 30 }); defer p.deinit(); while (p.nextEffect()) |_| {} p.setCwd(0, "/tmp/newtty-dir"); - try std.testing.expect(p.executeBuiltinLine(0, "Tty")); + try std.testing.expect(p.executeBuiltinLine(0, "Term")); const free = p.active; try std.testing.expect(free != 0); const nt = p.panes[free] orelse return error.NoNewPane; @@ -944,11 +944,11 @@ test "a terminal respawned into a closed pane's slot hangs the old shell up firs // end the new shell and leave the old one running. const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 }); defer p.deinit(); - try std.testing.expect(p.executeBuiltinLine(0, "Tty")); + try std.testing.expect(p.executeBuiltinLine(0, "Term")); const slot = p.active; while (p.nextEffect()) |_| {} try p.removePane(slot, null); - try std.testing.expect(p.executeBuiltinLine(0, "Tty")); + try std.testing.expect(p.executeBuiltinLine(0, "Term")); try std.testing.expectEqual(slot, p.active); var closed = false; var spawned = false; @@ -965,7 +965,7 @@ test "a terminal respawned into a closed pane's slot hangs the old shell up firs try std.testing.expect(closed and spawned); } -test "first document fallback splits like Tty from the originating pane" { +test "first document fallback splits like Term from the originating pane" { for ([_]u16{ 100, 198 }) |width| for (0..3) |from| { for ([_]bool{ false, true }) |collapsed| { const p = try Pardes.init(std.testing.allocator, .{ .cols = width, .rows = 62, .shells = 3 }); @@ -1608,43 +1608,55 @@ test "a restored terminal's tag names neither the REPL it was nor the shell it h try std.testing.expect(pane.repl == null and pane.tag.own == null); const shown = try tagline.tagText(restored, restored.scratch.allocator(), pane); try std.testing.expect(std.mem.indexOf(u8, shown, "python-a") == null); - try std.testing.expect(std.mem.indexOf(u8, shown, "Tty+fish") == null); + try std.testing.expect(std.mem.indexOf(u8, shown, "Term+fish") == null); } -test "a Tty started by a shell's path keeps the path in its Tty+ word" { +test "a Term started by a shell's path keeps the path in its Term+ word" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); defer p.deinit(); while (p.nextEffect()) |_| {} - try std.testing.expect(p.executeBuiltinLine(0, "Tty /bin/sh")); + try std.testing.expect(p.executeBuiltinLine(0, "Term /bin/sh")); try std.testing.expect(p.active != 0); p.acknowledgeShell(p.active, "/bin/sh", false); - try std.testing.expect(std.mem.startsWith(u8, tagline.curTail(p.panes[p.active].?), " Tty+/bin/sh ")); + try std.testing.expect(std.mem.startsWith(u8, tagline.curTail(p.panes[p.active].?), " Term+/bin/sh ")); } -test "Tty+fish, one word a tag can hold, opens a terminal on that shell" { +test "Tty, Term's old name in saved tags, runs as Term, bare and with its +shell" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); defer p.deinit(); while (p.nextEffect()) |_| {} - // sh, the one shell every host has. try std.testing.expect(p.executeBuiltinLine(0, "Tty+sh")); + try std.testing.expectEqualStrings("sh", p.panes[p.active].?.shell.?); + const first = p.active; + p.active = 0; + try std.testing.expect(p.executeBuiltinLine(0, "Tty")); + try std.testing.expect(p.active != 0 and p.active != first); +} + +test "Term+fish, one word a tag can hold, opens a terminal on that shell" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); + defer p.deinit(); + while (p.nextEffect()) |_| {} + // sh, the one shell every host has. + try std.testing.expect(p.executeBuiltinLine(0, "Term+sh")); try std.testing.expect(p.active != 0); try std.testing.expectEqualStrings("sh", p.panes[p.active].?.shell.?); p.acknowledgeShell(p.active, "/bin/sh", false); - try std.testing.expect(std.mem.startsWith(u8, tagline.curTail(p.panes[p.active].?), " Tty+sh ")); + try std.testing.expect(std.mem.startsWith(u8, tagline.curTail(p.panes[p.active].?), " Term+sh ")); p.active = 0; // A shell that is not there is said, not quietly replaced, and the // pane that asked gets no shell of its own. const before = p.active; const caller = p.panes[0].?; - try std.testing.expect(p.executeBuiltinLine(0, "Tty /nonexistent")); + try std.testing.expect(p.executeBuiltinLine(0, "Term /nonexistent")); try std.testing.expect(p.active == before and caller.shell == null); try std.testing.expect(std.mem.indexOf(u8, caller.msg[0..caller.msg_len], "shell \"/nonexistent\" not found") != null); - try std.testing.expect(p.executeBuiltinLine(0, "Tty fsh-not-a-shell")); + try std.testing.expect(p.executeBuiltinLine(0, "Term fsh-not-a-shell")); try std.testing.expect(caller.shell == null); // A directory passes access(X_OK); it is no shell either. - try std.testing.expect(p.executeBuiltinLine(0, "Tty /etc")); + try std.testing.expect(p.executeBuiltinLine(0, "Term /etc")); try std.testing.expect(p.active == before); - try std.testing.expect(std.mem.indexOf(u8, caller.msg[0..caller.msg_len], "Tty: not a shell: /etc is a directory") != null); + try std.testing.expect(std.mem.indexOf(u8, caller.msg[0..caller.msg_len], "Term: not a shell: /etc is a directory") != null); // Only a word that says so splits at `+`: `Dump+x.zon` is no Dump. try std.testing.expect(!p.executeBuiltinLine(0, "Dump+x.zon")); try std.testing.expect(!p.executeBuiltinLine(0, "Msg+hello")); @@ -2417,13 +2429,13 @@ test "Save reaches every tagline with text behind it and no other" { // A scratch is an output buffer that wears the FILE tails. out.file.?.output = .{ .from = .{ .cmd = std.meta.stringToEnum(Builtin, "New").? } }; - try std.testing.expectEqualStrings(" Save Tty Collapse Del", tagline.curTail(out)); + try std.testing.expectEqualStrings(" Save Term Collapse Del", tagline.curTail(out)); // An image's bytes on disk already are what they are: nothing of the // pane's own is unwritten, so the word is absent and inert. const img_id = p.freeSlot().?; const img = try panes.Image.create(p, img_id, "/tmp/pardes-tag.ppm", &.{}); - try std.testing.expectEqualStrings(" Tty Collapse Del", tagline.curTail(img)); + try std.testing.expectEqualStrings(" Term Collapse Del", tagline.curTail(img)); try std.testing.expect(p.executeBuiltinLine(img_id, "Save")); try std.testing.expect(img.prompt != .save); var buf: [256]u8 = undefined; @@ -3804,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. `--tty` names `.tty`; a core + /// it to be read off the options below. `--tui` 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. @@ -5024,7 +5036,7 @@ pub const Pardes = struct { } /// A shell a dead session left, taken in (Adopt): a terminal pane made - /// for it as the Tty word makes one, its greeting off (the shell is up + /// for it as the Term word makes one, its greeting off (the shell is up /// already), whose spawn the host answers with that shell's pty. Its id, /// or null with no room. An input, as every host write into the core /// is: a replica of the session makes the same pane. @@ -5035,7 +5047,7 @@ pub const Pardes = struct { for (p.panes) |slot| if (slot) |pn| { newest = @max(newest, pn.serial); }; - _ = p.executeBuiltinLine(p.active, "Tty"); + _ = p.executeBuiltinLine(p.active, "Term"); for (p.panes, 0..) |slot, id| if (slot) |pn| if (pn.serial > newest and pn.isTerminal()) { pn.greet = false; return @intCast(id); @@ -5061,14 +5073,14 @@ pub const Pardes = struct { pane.shell_failed = false; pane.had_shell = true; pane.fs.unmarked = !prompt_marks; - // The tag's Tty word names the shell the host ran, and a click - // on it (`Tty+fish`) opens another of the same. + // The tag's Term word names the shell the host ran, and a click + // on it (`Term+fish`) opens another of the same. if (pane.command == null) { // A shell given as a path keeps it: its bare name would find // nothing, or another program, on the usual paths. const base = if (pane.shell) |given| (if (std.mem.indexOfScalar(u8, given, '/') != null) given else std.fs.path.basename(executable)) else std.fs.path.basename(executable); - const rest = tagline.terminal_pane_tail[" Tty".len..]; - if (std.fmt.bufPrint(&pane.shell_tail, " Tty+{s}{s}", .{ base, rest })) |tail| { + const rest = tagline.terminal_pane_tail[" Term".len..]; + if (std.fmt.bufPrint(&pane.shell_tail, " Term+{s}{s}", .{ base, rest })) |tail| { pane.shell_tail_len = @intCast(tail.len); } else |_| {} } @@ -5416,7 +5428,7 @@ pub const Pardes = struct { pane.command_pty = false; exec.commandDone(p, id, 127); } else if (pane.command == null and !pane.had_shell) { - // A Tty whose shell never ran: no dead pane left behind; the + // A Term whose shell never ran: no dead pane left behind; the // write that asked for it has failed with why. A terminal whose // shell was started again (pty/ctl exec) keeps its pane. p.unplaced.set(id); @@ -6244,7 +6256,7 @@ pub const Pardes = struct { // global window ops (any mode): Alt-n new terminal below, Alt-c move // the active terminal into a fresh column if (hit(key, config.new_shell_below)) { - const free = p.freeSlot() orelse return p.reportError(p.active, "Tty", error.NoPaneSlots); + const free = p.freeSlot() orelse return p.reportError(p.active, "Term", error.NoPaneSlots); const nt = p.newShell(free, "") catch return; nt.greet = true; // From a tag, as a 9P new is: acme's t->w == nil. diff --git a/src/replica.zig b/src/replica.zig index 8cacb075..a6014f5b 100644 --- a/src/replica.zig +++ b/src/replica.zig @@ -2109,7 +2109,7 @@ pub const Peers = struct { } /// Every client told `why` and let go, its view with it: an Upgrade's - /// exec is next (tty.zig `upgradeNow`). What each was sent goes first, + /// exec is next (tui.zig `upgradeNow`). What each was sent goes first, /// for up to 200 ms; a client then dials the session again. pub fn refuseAll(ps: *Peers, core: *Pardes, why: []const u8) void { if (ps.count() == 0) return; @@ -2757,7 +2757,7 @@ pub fn readLink(gpa: Allocator, fd: c_int, rest: *Framer, ctx: anytype, comptime rest.run(gpa, fd, ctx, Take.take); } -/// A replica client's link to its session, the terminal's (tty.zig +/// A replica client's link to its session, the terminal's (tui.zig /// `remote`) and the window's (gui.zig `remote`): its replica, its socket, /// what the session said, and what it checks. Drawing is the frontend's. pub const Link = struct { @@ -3666,7 +3666,7 @@ test "a host's Adopt and a terminal reader's failure are inputs: a replica makes defer a.core.gpa.free(bytes); const r = try Replica.initDump(gpa, 1, 0, bytes, .{ .cols = 80, .rows = 24 }); defer r.deinit(); - // What tty.zig's and gui.zig's adoptShell and a failed reader do between + // What tui.zig's and gui.zig's adoptShell and a failed reader do between // steps: they wrote the core straight, and every client joined again. const host = Stepping.begin(&a.t, null); const id = a.core.adoptShell().?; diff --git a/src/selection_pipe.zig b/src/selection_pipe.zig index 37cf22d0..207d45c2 100644 --- a/src/selection_pipe.zig +++ b/src/selection_pipe.zig @@ -168,7 +168,7 @@ pub const Outcome = union(enum) { ok: []u8, failed: Failure }; /// The in-flight set a host keeps while pipes run off its loop. /// -/// tty.zig and gui.zig each had this verbatim — same `finish` walk, same +/// tui.zig and gui.zig each had this verbatim — same `finish` walk, same /// `cancelAll`, same 16 — differing only in whether `add` asserted or returned /// a bool. It lives here beside the Job it tracks so a third host (the AppKit /// shell, which had no pipe support at all) does not have to grow a fourth. diff --git a/src/surface.zig b/src/surface.zig index aa0068e3..f5afdd98 100644 --- a/src/surface.zig +++ b/src/surface.zig @@ -477,7 +477,7 @@ pub const Chrome = struct { fx: u8 = 0, }; -/// The canonical interface: what a frame of pardes IS. The tty shell writes +/// The canonical interface: what a frame of pardes IS. The tui shell writes /// these cells to vaxis one-to-one; the SDL shells rasterize them. pub const Surface = struct { /// `box` is acme's boxcursor, shown while a pane or a column is carried diff --git a/src/tagline.zig b/src/tagline.zig index 7af9ba66..e7194981 100644 --- a/src/tagline.zig +++ b/src/tagline.zig @@ -47,7 +47,7 @@ pub fn dirty(pane: *const panes.Pane) bool { return panes.Output.fileTraits(f.output).saves and (f.revision != f.saved_revision or f.disk_gone); } /// What a column's tag says until someone edits it. -pub const column_tag_default = "New Tty Find Grep Joincol Delcol"; +pub const column_tag_default = "New Term Find Grep Joincol Delcol"; /// What a header says until someone edits it: for the workspace the /// fixed builtins, plus `Restore <path>` once a dump exists. @@ -135,7 +135,7 @@ pub fn pathPrefix(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]co if (pane.command_status) |n| return std.fmt.allocPrint(arena, "{s} ({s}{s}) exit {d}{s}{s}", .{ (try shownDir(arena, pane)), shown, more, n, gap, id }); return std.fmt.allocPrint(arena, "{s} ({s}{s}) exit ?{s}{s}", .{ (try shownDir(arena, pane)), shown, more, gap, id }); } - // A bound REPL says what it is bound as, beside its Tty word, while its + // A bound REPL says what it is bound as, beside its Term word, while its // program runs: a command REPL whose command exited says no id. if (pane.repl != null and !(pane.command != null and pane.command_done)) { var idbuf: [48]u8 = undefined; diff --git a/src/tape.zig b/src/tape.zig index c0f33f21..78b3c34b 100644 --- a/src/tape.zig +++ b/src/tape.zig @@ -1258,7 +1258,7 @@ pub fn startFromEnv() void { /// digest checked; 0 when none diverged. pub fn replayMain(io: std.Io, path: []const u8) u8 { const gpa = std.heap.c_allocator; - // What a shell starts before its core (tty.zig's localSession). + // What a shell starts before its core (tui.zig's localSession). pardes.image.start(io, gpa); if (comptime pardes.pdf_enabled) pardes.pdf.start(gpa); pardes.syntax.start(gpa); diff --git a/src/terminal.zig b/src/terminal.zig index 86eec32d..2bd41030 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -994,7 +994,7 @@ pub fn reviveShell(pane: *Pane) void { ingest(pane, "\x1b[?1l\x1b>\x1b[?25h\x1b[?7h\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l\x1b[?2004l\x1b[<u"); ingest(pane, restored_banner); // What the old shell was, ran and said is gone with it: the REPL it - // ran, the Tty+ word naming it. + // ran, the Term+ word naming it. pane.shell_spoke = false; pane.had_shell = false; pane.shell_failed = false; @@ -1176,7 +1176,7 @@ test "a restored terminal keeps its history above a marker and gets a shell wher const pane = p.panes[0].?; feedOutput(p, pane, "old output\r\n$ ls\r\n"); try pane.setOwnedCwd("/tmp"); - pane.shell = try gpa.dupe(u8, "bash"); // `Tty bash`: it comes back as bash + pane.shell = try gpa.dupe(u8, "bash"); // `Term bash`: it comes back as bash try pardes.dump.dumpState(p); const restored = try pardes.dump.initFromDump(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }, p.dump_out.?); defer restored.deinit(); diff --git a/src/themes/acme.zig b/src/themes/acme.zig index 277249d3..4e4e9a43 100644 --- a/src/themes/acme.zig +++ b/src/themes/acme.zig @@ -20,7 +20,7 @@ //! acme's own: #eaffff in a 2px #8888cc ring, #000099 inside it when dirty. //! //! acme tints nothing in a tag; pardes tints the file's name, a +Name and -//! the Tty word everywhere, so here it is done quietly, in that same #000099 +//! the Term word everywhere, so here it is done quietly, in that same #000099 //! (draw.h's DMedblue): a navy that reads as ink until you look for it. pub const theme = .{ .name = "acme", diff --git a/src/tty/panel_compositor.zig b/src/tui/panel_compositor.zig index 67d3a6e6..67d3a6e6 100644 --- a/src/tty/panel_compositor.zig +++ b/src/tui/panel_compositor.zig diff --git a/src/tty/tty.zig b/src/tui/tui.zig index 4c054021..e7fde434 100644 --- a/src/tty/tty.zig +++ b/src/tui/tui.zig @@ -2401,7 +2401,7 @@ const Shell = struct { return core.setMessage(core.active, if (s.adopted == 0) "Adopt: no shell of a session that died is waiting" else std.fmt.bufPrint(&buf, "Adopt: {d} shell{s} taken in; what they showed is gone", .{ s.adopted, if (s.adopted == 1) "" else "s" }) catch "Adopt: shells taken in"); } if (s.adoptions_len < s.adoptions.len) { - // A terminal pane, as the Tty word makes one; its spawn takes + // A terminal pane, as the Term word makes one; its spawn takes // this pty instead of forking a shell (`spawn`). s.adoptions[s.adoptions_len] = .{ .pid = pid, .fd = fd, .pane = null }; s.adoptions_len += 1; diff --git a/src/tutor.txt b/src/tutor.txt index 5cfb245b..1de2a4e6 100644 --- a/src/tutor.txt +++ b/src/tutor.txt @@ -60,11 +60,11 @@ and an image's: | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| Save Tty Collapse Del -| Tty Save Mode Filter Collapse Del -| Tty PdfSections PdfTint PdfFit Collapse Del -| Tty Collapse Del +| New Term Find Grep Joincol Delcol +| Save Term Collapse Del +| Term Save Mode Filter Collapse Del +| Term PdfSections PdfTint PdfFit Collapse Del +| Term Collapse Del 1. Press : here: the keyboard goes to this pane's tag, on `Save`. Press A, type a space and Help, press Esc, then Tab: `Help` |
