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 | |
| 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
110 files changed, 474 insertions, 446 deletions
diff --git a/.agents/skills/pardes-9p/SKILL.md b/.agents/skills/pardes-9p/SKILL.md index 2b80c975..0c51394e 100644 --- a/.agents/skills/pardes-9p/SKILL.md +++ b/.agents/skills/pardes-9p/SKILL.md @@ -100,5 +100,5 @@ Keep `SHELL` (bash or fish): without it the terminals run `/bin/sh`, which gets no OSC 133 prompt marks, and `pty/run` answers `error no prompt marks`. -To test a change, build with `-Dplatform=tty` (it installs into +To test a change, build with `-Dplatform=tui` (it installs into `zig-out`): a bare `zig build` installs over `~/.local/bin`. diff --git a/.agents/skills/pardes/SKILL.md b/.agents/skills/pardes/SKILL.md index d49f8e50..6e2f2eff 100644 --- a/.agents/skills/pardes/SKILL.md +++ b/.agents/skills/pardes/SKILL.md @@ -101,7 +101,7 @@ Addresses are sam's (`#n /re/ ?re? $ a,b`). | Common words | | |---|---| | `Save` `Del` `Get` `Undo` `Edit` | pane; Del/Exit/Restore refuse once over unsaved text, again discards | -| `New` `Tty` `Tty+bash` `Newcol` `Delcol` | panes and columns | +| `New` `Term` `Term+bash` `Newcol` `Delcol` | panes and columns | | `Find name` `Grep text` `Recent` | listings in a `+Search` | | `Kill make` `Repl python` `Filter` `Mode` | terminals and commands | | `Dump` `Restore` `Config` `DumpConfig` `Theme x` | workspace and settings | @@ -7,7 +7,7 @@ over 9P, that any program can drive. Get the source with `git clone https://git.sr.ht/~gbrls/pardes && cd pardes` (also at https://git.0x4200.cafe/pardes). Install with Zig 0.17: -`zig build -Dplatform=tty --prefix ~/.local` for +`zig build -Dplatform=tui --prefix ~/.local` for `pardes` in a terminal, or `-Dplatform=gui` for the `pardes-gui` window. The terminal should report the mouse; Shift-Esc (the Esc a terminal pane's program gets) needs the kitty keyboard protocol, and images need kitty graphics (else they are drawn as PETSCII @@ -25,7 +25,7 @@ const deps_text = blk: { break :blk text; }; -pub const Platform = enum { tty, gui, web, macos, esp32p4 }; +pub const Platform = enum { tui, gui, web, macos, esp32p4 }; const PerfBuild = struct { compiler: []const u8, @@ -71,8 +71,8 @@ const gui_shaders = [_][]const u8{ }; pub fn build(b: *std.Build) void { - const requested_platform = b.option(Platform, "platform", "which shell to build (tty, gui, web, macos, esp32p4); absent builds the tty cli and the SDL gui together"); - const platform = requested_platform orelse .tty; + const requested_platform = b.option(Platform, "platform", "which shell to build (tui, gui, web, macos, esp32p4); absent builds the tui cli and the SDL gui together"); + const platform = requested_platform orelse .tui; const also_gui = requested_platform == null; // A bare `zig build` also copies the binaries into ~/.local/bin. Zig // 0.17 keeps the prefix in the maker process, out of this script's @@ -97,7 +97,7 @@ pub fn build(b: *std.Build) void { .os_version_min = .{ .semver = macos_min_version }, } else .{}, .esp32p4 => esp32p4_target, - .tty, .gui, .web => .{ + .tui, .gui, .web => .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .gnu, @@ -225,13 +225,13 @@ pub fn build(b: *std.Build) void { if (is_web and !is_web_target) return failBuild(b, web_step, "-Dplatform=web requires -Dtarget=wasm32-freestanding"); if (!is_web and (is_web_target or target.result.os.tag == .emscripten)) return failBuild(b, web_step, "wasm browser targets require -Dplatform=web"); if (platform == .web and dump_path == null) return failBuild(b, web_step, "-Dplatform=web requires -Ddump=<file.dump> (the browser has no ptys; state replays from an embedded dump)"); - if (enable_mupdf and is_web) return failBuild(b, web_step, "-Dmupdf=true is supported only by the native tty/Kitty and gui/SDL backends"); + if (enable_mupdf and is_web) return failBuild(b, web_step, "-Dmupdf=true is supported only by the native tui/Kitty and gui/SDL backends"); // The board's target is pinned (`target` above), so what is asked of // -Dtarget is checked, not what was resolved: another arch is refused, // not silently built for the board anyway. const requested_board = requested_target.result.cpu.arch == .riscv32 and requested_target.result.os.tag == .freestanding; if (is_esp32p4 and !requested_board) return failBuild(b, web_step, "-Dplatform=esp32p4 requires -Dtarget=riscv32-freestanding (ESP32-P4 firmware)"); - if (enable_mupdf and is_esp32p4) return failBuild(b, web_step, "-Dmupdf=true is supported only by the native tty/Kitty and gui/SDL backends"); + if (enable_mupdf and is_esp32p4) return failBuild(b, web_step, "-Dmupdf=true is supported only by the native tui/Kitty and gui/SDL backends"); if (is_esp32p4 and requested_grammars != null and requested_grammars.? != .disabled) return failBuild(b, web_step, "-Dplatform=esp32p4 has no tree-sitter: the grammars' parse tables are megabytes and the flash partition is 1.5 MiB (-Dtree-sitter=disabled)"); // build-time IO: slurps the grammars' highlights.scm queries, and reads @@ -249,7 +249,7 @@ pub fn build(b: *std.Build) void { .web => "src/web.zig", .macos => "src/macos.zig", .esp32p4 => "src/esp32p4.zig", - .tty, .gui => "src/main.zig", + .tui, .gui => "src/main.zig", }), .link_libc = !freestanding_core, }); @@ -260,7 +260,7 @@ pub fn build(b: *std.Build) void { .link_libc = true, }); - const isolated_mod: ?*std.Build.Module = if (platform == .tty) b.createModule(.{ + const isolated_mod: ?*std.Build.Module = if (platform == .tui) b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("src/main.zig"), @@ -901,7 +901,7 @@ pub fn build(b: *std.Build) void { \\ ; // And its event queue: a pop that makes room woke one blocked - // writer, and only on the pop from full. The tty has two writers + // writer, and only on the pop from full. The tui has two writers // (a pane's pty reader, and the input reader posting the frame // ack's wake), so when the loop emptied a full queue in one batch // the writer not woken waited on for good: under `yes` the pane @@ -1041,10 +1041,10 @@ pub fn build(b: *std.Build) void { // docs/typ/builtins-<platform>.json: every builtin, from the registry and the Help // rows (src/builtins_json.zig), rewritten in the source tree so a plain // `typst compile` reads it too; a unit test fails when it is stale. - // A terminal build writes builtins-tty.json and a window build + // A terminal build writes builtins-tui.json and a window build // builtins-gui.json; style.typ merges the two into one glossary. - const builtins_json_step = b.step("builtins-json", "rewrite docs/typ/builtins-<tty|gui>.json from the builtin registry (-Dplatform=tty or gui)"); - if (requested_platform == .tty or requested_platform == .gui) { + const builtins_json_step = b.step("builtins-json", "rewrite docs/typ/builtins-<tui|gui>.json from the builtin registry (-Dplatform=tui or gui)"); + if (requested_platform == .tui or requested_platform == .gui) { const gen = b.addExecutable(.{ .name = "pardes-gen-builtins-json", .root_module = b.createModule(.{ .target = target, .optimize = optimize, @@ -1057,7 +1057,7 @@ pub fn build(b: *std.Build) void { update.addCopyFileToSource(json, b.fmt("docs/typ/builtins-{s}.json", .{@tagName(platform)})); builtins_json_step.dependOn(&update.step); for (doc_renders) |r| if (r) |run| run.step.dependOn(&update.step); - } else builtins_json_step.dependOn(&b.addFail("builtins-json writes one build's list: pass -Dplatform=tty or -Dplatform=gui").step); + } else builtins_json_step.dependOn(&b.addFail("builtins-json writes one build's list: pass -Dplatform=tui or -Dplatform=gui").step); const gui_shell_mod: ?*std.Build.Module = gui_mod orelse if (platform == .gui) root_mod else null; @@ -1409,13 +1409,13 @@ pub fn build(b: *std.Build) void { } const run_image_harness = b.addRunArtifact(image_harness); run_image_harness.addArtifactArg(exe); - run_image_harness.addArg(if (platform == .gui) "gui" else "tty"); + run_image_harness.addArg(if (platform == .gui) "gui" else "tui"); run_image_harness.has_side_effects = true; b.step("image-harness", "exercise native Kitty/SDL image rendering end to end").dependOn(&run_image_harness.step); // Kitty graphics through a terminal pane, end to end: a client in // the pane's bash (and kitten icat, chafa when installed), a kitty - // terminal outside (tty) or the GPU capture (gui). test/kitty.zig + // terminal outside (tui) or the GPU capture (gui). test/kitty.zig // is the same protocol at the core. const kitty_client = b.addExecutable(.{ .name = "pardes-kitty-client", @@ -1443,7 +1443,7 @@ pub fn build(b: *std.Build) void { const run_kitty_harness = b.addRunArtifact(kitty_harness); run_kitty_harness.addArtifactArg(exe); run_kitty_harness.addArtifactArg(kitty_client); - run_kitty_harness.addArg(if (platform == .gui) "gui" else "tty"); + run_kitty_harness.addArg(if (platform == .gui) "gui" else "tui"); run_kitty_harness.has_side_effects = true; b.step("kitty-harness", "kitty graphics through a terminal pane end to end (a client inside, a kitty terminal or the GPU capture outside)").dependOn(&run_kitty_harness.step); @@ -1451,7 +1451,7 @@ pub fn build(b: *std.Build) void { if (enable_mupdf) { const run_pdf_harness = b.addRunArtifact(image_harness); run_pdf_harness.addArtifactArg(exe); - run_pdf_harness.addArg(if (platform == .gui) "gui" else "tty"); + run_pdf_harness.addArg(if (platform == .gui) "gui" else "tui"); run_pdf_harness.addArg("pdf"); run_pdf_harness.has_side_effects = true; pdf_harness_step.dependOn(&run_pdf_harness.step); @@ -1968,7 +1968,7 @@ pub fn build(b: *std.Build) void { unit_step.dependOn(&run_deck_test.step); if (unit_match) |check| check.addArtifactArg(deck_test); - if (platform == .tty or platform == .gui) { + if (platform == .tui or platform == .gui) { const shell_test = b.addTest(.{ .root_module = root_mod, .filters = test_filters }); if (test_nonce) |nonce| shell_test.root_module.addImport("test_rebuild_nonce", nonce); test_build.dependOn(&shell_test.step); diff --git a/build/snap.zig b/build/snap.zig index 75e578bf..544144d9 100644 --- a/build/snap.zig +++ b/build/snap.zig @@ -64,7 +64,7 @@ pub fn addTty(b: *std.Build, opts: struct { } const run_process_test = b.addRunArtifact(process_test); run_process_test.addArtifactArg(opts.exe); - run_process_test.addArg(if (opts.gui) "--backend=gui" else "--backend=tty"); + run_process_test.addArg(if (opts.gui) "--backend=gui" else "--backend=tui"); run_process_test.addPassthruArgs(); run_process_test.has_side_effects = true; b.step("process-test", "run the process tests: real sessions driven over their sockets (-- [filter])").dependOn(&run_process_test.step); diff --git a/docs/effects.md b/docs/effects.md index 894bd75d..1c1a9cac 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -266,13 +266,13 @@ it does in a pixel shell. | # | effect | switch | state | review material | verdict | |---|---|---|---|---|---| -| T2 | cursor jump trail | `JumpTrail on\|off` (off) | a jump of three cells or more leaves 3 to 5 cells of trail behind the cursor, their ground drawn toward the text's colour in OKLab, most beside it, fading in 120 ms; truecolor terminals (vaxis's answer or COLORTERM); never the cursor's cell, a selection or outside the focused body; off under Motion off; a few cells a frame | .scratch/render/tty/trail/ (pyte replay of a real tty session at 60 fps: trail-forge.mp4, zooms) | pending | +| T2 | cursor jump trail | `JumpTrail on\|off` (off) | a jump of three cells or more leaves 3 to 5 cells of trail behind the cursor, their ground drawn toward the text's colour in OKLab, most beside it, fading in 120 ms; truecolor terminals (vaxis's answer or COLORTERM); never the cursor's cell, a selection or outside the focused body; off under Motion off; a few cells a frame | .scratch/render/tty/trail/ (pyte replay of a real tui session at 60 fps: trail-forge.mp4, zooms) | pending | | T1 chip shadow | `ChipShadow on\|off` (off) | a notice chip casts a shadow a cell right and down in its body: half blocks (▌ ▀ ▘) in a darker ground on blank cells, the ground 35% darker (OKLab) under text; never the cursor, a selection, a tag or another chip; truecolor only | .scratch/render/tty/shadow/ (forge, acme; zooms) | pending | | T4 ordered swap | `PanelDissolve` (off) | the terminal's dissolve swaps each changed cell once at its place in a 4x4 Bayer matrix (shifted per pane), an even patterned screen instead of noise; hit-testing follows the same order | .scratch/render/tty/dissolve/ (ordered-swap-sim: the matrix applied to two real frames; see note) | pending | | T7 thumb flash | `ThumbFlash on\|off` (off) | a pane whose view moves has its scroll thumb drawn toward the text's colour, 60% at once and back over 250 ms (quadratic); the thumb only, never a focus indicator; truecolor only; a few cells a frame while it fades | .scratch/render/tty/thumb-flash.mp4, thumb-flash-strip.png (pyte replay, forge) | pending | | T3 wipe | `PanelCurtain` (off) | the curtain becomes a wipe, left to right: new grid behind the head, old ahead, and a soft edge of two columns whose ink and ground sit 2/3 and 1/3 of the way to the old ground (OKLab; a palette colour steps at the half); only the head's columns change a frame; the head's cells are not hit-testable until settled | .scratch/render/tty/wipe/ (curtain-gui.mp4, curtain-edge-zoom.png) | pending | -Note on T4's material: a pane opening in a tty session recorded through +Note on T4's material: a pane opening in a tui session recorded through pyte did not animate (PanelSlide did not either there), so the review material applies the same matrix to two real frames of that session; the unit test holds the order (a 4x4 block reveals exactly t x 16 cells). diff --git a/docs/helix-keys.md b/docs/helix-keys.md index 04aa60dd..b172caab 100644 --- a/docs/helix-keys.md +++ b/docs/helix-keys.md @@ -133,7 +133,7 @@ language-backend queries, and the shell pipe. | `Alt-c` | move active terminal to a fresh column (outside raw tty) | helix `Alt-c` is change-noyank; the pardes window op wins (do-not-touch contract). `Alt-d` + `i` covers the behavior | waived (`alt-c-window-op`) | | `Space` (normal, body) | starts the pardes LEADER: a key path runs the same builtin words used by tags and the topbar. The main groups are `f` files, `h` docs, `c` columns, `t` toggles/effects, `a` panel animations, `s` session, `j` jumps, `l` language, and `w` directional focus; `SPC ?` lists every path and `<prefix> ?` lists one group in `+Help`. Neither `Exit` (quits the editor, acme's Exit) nor `Kill` (stops the commands pardes typed into terminals, acme's Kill) has a leader path: both are the topbar's and the root `ctl`'s. The pending path appears on the active pane's transient body/message row. Esc or an unmapped key abandons it. Paths, Help rows, and dispatch are all generated from the builtin registry at comptime; the leader applies only to a BODY in normal mode because tags and tty programs own their input | pardes-specific; helix spends Space on pickers/LSP (section C), while pardes uses acme-style executable words | | `SPC y` `SPC Y` `SPC p` `SPC P` `SPC R` | helix's clipboard menu on helix's own letters: yank the selection to the system clipboard (`ClipYank`) or the PRIMARY selection alone (`ClipYankMain`), paste the system clipboard after (`ClipPaste`) / before (`ClipPasteBefore`) the selection, replace the selection with it (`ClipReplace`) | the same as `"+y`, `"+p`, `"+P`, `"+R`: register `+` (and `*`) IS the desktop's clipboard, the only register that reaches it. `SPC y` writes `+` alone, as helix's does, not the default register too. Builtins rather than bare chords because a leader path names a builtin: they land in Help's index and are executable words like every other verb. The clipboard holds one text, so N values go out joined by newlines, as helix sends them. On a tty the write is OSC 52 out and the READ is OSC 52 back, which many terminals refuse or gate — so `SPC y` works there and `SPC p` can be a no-op | out of corpus | -| a paste from the OUTER terminal | one `Event.paste`, spliced in at the cursor | the tty shell enables bracketed paste and coalesces `paste_start`..`paste_end` into a single event; before that the bytes arrived as individual key presses and normal mode RAN them, which is how a pasted `d` deleted a line. The bytes deliberately never enter the yank register — clipboard and default register are separate stores in both directions | pardes-specific | +| a paste from the OUTER terminal | one `Event.paste`, spliced in at the cursor | the tui shell enables bracketed paste and coalesces `paste_start`..`paste_end` into a single event; before that the bytes arrived as individual key presses and normal mode RAN them, which is how a pasted `d` deleted a line. The bytes deliberately never enter the yank register — clipboard and default register are separate stores in both directions | pardes-specific | | `/` (a text) | a query pane under the pane (`src/Query.zig`): a `+Search` whose line 1 is the query, typed into; helix's regex with smart case, every match tinted and ticked on the rail as you type (the pane's places, `src/Places.zig`), the first after the cursor selected (helix's incremental preview). `Ctrl-n`/`Ctrl-p` step while typing; Enter lands, fills `/` and keeps the rows as text; Esc while typing restores the text and closes the pane. Line 1's first word names the source (`/`, `Find`, `Grep`, `Recent`, `Panes`, `Symbols`, `All`, `Refs`, `Def`, `Impl`, `Diagnostics`), helix's pickers as one pane. A terminal's and a PDF's `/` keep the notice-band prompt and its `+Search` | helix's `/` semantics (regex, smart case, preview); the pane is pardes' | pardes-specific | | `n` / `N` | next / previous match of the text's places when a query pane fed them (a `/`, a list's places in this text: refs, diagnostics, a Grep's hits), round the ends without a message; else the last search register's regex in the current text, as before; counts repeat | only the primary selection is replaced; in select mode each match is added and becomes primary. Named registers work. `*` sets the pattern from selections with word boundaries (`Alt-*` without) and seeds the text's query pane with it, the keyboard staying. The former Look ring is `LookNext` / `LookPrev`, `SPC j n` / `SPC j p`. PDFs retain their location-result navigation | helix-verified | @@ -341,7 +341,7 @@ text. | `Ctrl-u` | kill to line start | | helix-verified (phase 5) | | `Ctrl-k` | kill to line end | | helix-verified (phase 5) | | `Ctrl-h` | delete prev char (Backspace alias) | | helix-verified (phase 5) | -| `Ctrl-d` / `Delete` | delete next char; at line end joins the next line up | `Key.delete` (0xF0009) added + `mapKey` in tty.zig/gui.zig (vaxis + SDLK) + `forwardKey` sends `ESC[3~` in tty mode | helix-verified (phase 5) | +| `Ctrl-d` / `Delete` | delete next char; at line end joins the next line up | `Key.delete` (0xF0009) added + `mapKey` in tui.zig/gui.zig (vaxis + SDLK) + `forwardKey` sends `ESC[3~` in tty mode | helix-verified (phase 5) | | `Ctrl-j` | insert newline (Enter alias) | | helix-verified (phase 5) | | `Home` / `End` | line start / line end past-the-last-char (`goto_line_end_newline`) | file panes (terminal insert cursor rides its run, as before) | helix-verified (phase 5) | | `PageUp` / `PageDown` | cursor page up / down, col kept (clamped to line) | file panes | helix-verified (phase 5) | diff --git a/docs/macos.md b/docs/macos.md index 3ee55d0a..ddd7eee1 100644 --- a/docs/macos.md +++ b/docs/macos.md @@ -77,7 +77,7 @@ fourteen are filled in (`src/macos.zig:1761`). The machine-local half of those methods is no longer this file's. `forkShell`, `writeFileBytes` and `writeFd` live in `src/host_io.zig` and are shared with -the tty shell, the SDL shell and the detached daemon; `src/macos.zig` calls +the tui shell, the SDL shell and the detached daemon; `src/macos.zig` calls them (`:1807`, `:1823`, `:1848`, `:1863`) and its own copies, together with the four `extern "c"` declarations they needed (`forkpty`, `execv`, `chdir`, `_exit`), are gone. Two `extern "c"` declarations remain here: `setenv`, and @@ -473,7 +473,7 @@ has none: between fork and exec can deadlock on the heap a pty reader thread was holding. Every pane is emulated by the bundled VT, so the value describes pardes and never the terminal pardes was started from; `-Dplatform=gui` and - the tty shell take the same path, where the difference is only that their + the tui shell take the same path, where the difference is only that their launcher usually happened to set something. The names come from `config.child_term` / `child_colorterm` / `child_term_program`, and `TERM` is deliberately `xterm-256color` rather than a name with no installed @@ -586,7 +586,7 @@ theme it cannot. showed *nothing at all*: with `native_images` false the core assumes a terminal that cannot draw pixels and degrades a document to counted page turns, and this host never set it. It does now — this shell draws pixels, which is a fact -rather than a question (the tty backend has to ask the terminal about +rather than a question (the tui backend has to ask the terminal about kitty-graphics support; the SDL one just says yes, as we do). The transport is `pardes_image_s`, walked with `pardes_frame_images` / @@ -1122,7 +1122,7 @@ used for the table and is not folded into the direct-path claim. ## Not implemented - **The `lsp` effect.** Needs a worker plus a snapshot of the pane's path and - content taken *before* it starts, as `LspJob` in `tty.zig` does; the core + content taken *before* it starts, as `LspJob` in `tui.zig` does; the core keeps editing while a query is in flight. Until then every query is answered with an EMPTY `lsp_resp` rather than dropped — dropping one leaves the keystroke that asked (insert-mode Tab after a dot) waiting forever, and dead diff --git a/docs/next-daemon.md b/docs/next-daemon.md index 5537bf1a..9865e315 100644 --- a/docs/next-daemon.md +++ b/docs/next-daemon.md @@ -448,7 +448,7 @@ microseconds. Gates, on the line rebased onto main's screen-state terminals (mnlwlpvk): -- `zig build replay -Dplatform=tty`: 113 snapshot scripts pass (the 110, +- `zig build replay -Dplatform=tui`: 113 snapshot scripts pass (the 110, views.snap, views-term.snap and views-pan.snap), their 131 tapes replay in all three replicas (393 runs, 29,436 digests); 20 monkey seeds at one view (60 runs, 14,004 digests) and 20 at three views (60 runs, 9,666 @@ -488,9 +488,9 @@ Everything of ours lives in `/root/pardes-test`, nothing outside it. ```sh export PATH=$HOME/.local/bin:$PATH E='env -u PARDES_PID -u PARDES_PANE -u PARDES_9P' - $E zig build -Dplatform=tty -Dtarget=x86_64-freebsd.15.0 >log 2>&1 + $E zig build -Dplatform=tui -Dtarget=x86_64-freebsd.15.0 >log 2>&1 # zig-out/bin/pardes-freebsd-x86_64 - $E zig build test-install -Dplatform=tty -Dtarget=x86_64-freebsd.15.0 >log 2>&1 + $E zig build test-install -Dplatform=tui -Dtarget=x86_64-freebsd.15.0 >log 2>&1 # zig-out/test/{main,panes,kitty,9p,fonts,...}, named for their root files ``` @@ -760,7 +760,7 @@ thread start in the render). ## Tty throughput notes -Found and fixed 2026-10-29 (`src/tty/tty.zig`, `waitInput`). +Found and fixed 2026-10-29 (`src/tui/tui.zig`, `waitInput`). - **What the 1 GB `yes` cell measures is mostly the kernel.** A pty's output processing (ONLCR, a `\n` made `\r\n`) costs the writer about @@ -907,7 +907,7 @@ against that tty, is the Tty throughput notes' keystroke-to-present. tapes, plus real vim, nvim, htop, less and btop sessions recorded through a pty. Its corpus and recorder are in `.scratch/daemon/term`. - **Numbers** (ReleaseFast: `PARDES_SCREEN_STATE=<dir> zig build core-test - -Dplatform=tty -Doptimize=ReleaseFast -Dtest-filter=screen_state`, which + -Dplatform=tui -Doptimize=ReleaseFast -Dtest-filter=screen_state`, which runs under std.testing's checking allocator): - Encode, 200x60, every row new: p50 250 us, p99 487 us, 29.8 KB. - Encode, 200x60, nothing new: p50 71 us, p99 139 us, 534 bytes. That @@ -2180,7 +2180,7 @@ scripts are in `.scratch/daemon/remote/t2/`. `terminal.cellAt` (the final gate's notes, at the end). The gates, once at the end (Debug unless said): -- `zig build unit-test -Dplatform=tty` passes, its perf gate too; +- `zig build unit-test -Dplatform=tui` passes, its perf gate too; `-Dplatform=gui` 1563 of 1575, 10 skipped, and the two that fail on main already (`tagline pointer mapping...`, `a tag caret past its row's end...`). @@ -2800,7 +2800,7 @@ The hook for the remote client (its `Replica` and stream as they are): Measured. -- **The harness** (`zig build replicas -Dplatform=tty -- --echo`): one +- **The harness** (`zig build replicas -Dplatform=tui -- --echo`): one authority and one replica over part A's delayed, jittered link, the authority's pty a shell played in the harness (`FakeShell`): a line editor at a prompt with pardes's marks and Tab completion, and the @@ -2885,7 +2885,7 @@ The gates: rendered otherwise than predicted; it passes at 20 seeds, Debug and ReleaseFast. `zig build replicas` passes at 20 seeds, ReleaseFast (and 4 in Debug). -- Unit tests tty (`zig build unit-test -Dplatform=tty`, its perf gate +- Unit tests tty (`zig build unit-test -Dplatform=tui`, its perf gate too), the full `core-test`, and the 113 snapshot scripts pass; the GUI build's echo tests pass (`core-test -Dplatform=gui`). @@ -2957,7 +2957,7 @@ the installed (ReleaseSafe) binaries through the suites that start a real pardes. Gates, Debug unless said: -- `core-test`, `unit-test -Dplatform=tty` (its perf gate too), `snap` +- `core-test`, `unit-test -Dplatform=tui` (its perf gate too), `snap` (113/113), `replay`, `replicas` (no divergence, no wrong delta at 30/80/207 ms), `9p-io-test`, `fs-test`, `test/daemon.py` (20 cycles), `test/daemon.py --upgrade`, `test/fs.py`: all pass. @@ -3209,7 +3209,7 @@ Gates (Debug unless said; scripts and logs in `.scratch/daemon/amort/`): - **Suites**, once at the end: `core-test` (its run beside the box measurements had the 9P failure above; again, all pass), `unit-test - -Dplatform=tty` (its perf gate, and shared-libs-check, which now refuses + -Dplatform=tui` (its perf gate, and shared-libs-check, which now refuses a second zstd too), `snap` 113 of 113, `replay` (113 scripts, 20 monkey seeds, none panicked or diverged), `replicas`, `9p-io-test`, `fs-test`, `test/daemon.py` 20 cycles (its far clients included), `--upgrade` @@ -3521,7 +3521,7 @@ Gates (Debug unless said; scripts and logs in `.scratch/daemon/guirep/`): cycles, a second window detached alone): pass, Debug and ReleaseSafe (SDL's offscreen driver). - **Suites**, once at the end (before the tests' fix and the rebase below): - `core-test -Dplatform=tty`, `unit-test -Dplatform=tty` (its perf gate), + `core-test -Dplatform=tui`, `unit-test -Dplatform=tui` (its perf gate), `snap` 113 of 113, `replay` (113 scripts, 20 monkey seeds, none panicked or diverged), `replicas`, `9p-io-test`, `fs-test`, `test/daemon.py` 20 cycles, `--window-clients`, `--upgrade` (unstamped Debug to stamped), diff --git a/docs/next-pdfrender.md b/docs/next-pdfrender.md index e006aa48..4c8565d8 100644 --- a/docs/next-pdfrender.md +++ b/docs/next-pdfrender.md @@ -217,7 +217,7 @@ Look. `mupdf-check` (25, the lanes test among them); unit filters `PDF`, `pdf`, `off the loop`, `kept pages`, `page sizes off the loop`, `watch`, `JumpScope`, `Back`, `jump`, `Jump`, `Recent`, `a PDF's jumps`: green. The -snapshot suite (`zig build snap -Dplatform=tty`): all 110 scripts. The tty +snapshot suite (`zig build snap -Dplatform=tui`): all 110 scripts. The tty compiles (the suite builds it). The two baseline failures were not run. ## Open questions and positions diff --git a/docs/next-tests.md b/docs/next-tests.md index a3f298ff..a16a7cf9 100644 --- a/docs/next-tests.md +++ b/docs/next-tests.md @@ -52,7 +52,7 @@ agent's survey. The `e2e` line (kbdin, mousein) is its first step. Each backend's own (2026-11-04, the user: an effect's test is the backend's): - - **`zig build process-test -Dplatform=tty` drives `pardes`, `-Dplatform=gui` + - **`zig build process-test -Dplatform=tui` drives `pardes`, `-Dplatform=gui` drives `pardes-gui`,** hidden (PARDES_TEST, SDL_VIDEO_DRIVER=offscreen, no display of the user's) on a pty of its own and a 160x50 grid. `Detached.frame()` waits for the window to say it is idle and reads its @@ -168,7 +168,7 @@ What the M left need, most first: a host performs the effect. A Session option that performs saves (and keeps pty writes) unlocks a group in each area. - **A real host (T2):** terminals' output and shells, command panes - finishing, Tty and pty/ctl exec, a missing interpreter. + finishing, Term and pty/ctl exec, a missing interpreter. - **Image panes:** they need the decoder worker Session does not start. - **LSP:** a fake language server. - **Not reached yet:** jumps and Back/Forward, Zerox, Get, Restore, @@ -193,7 +193,7 @@ Traps the migrators found in Session, each now in its tests' code: `p.panes[`, `.file.?`, `p.rects` and the like. 2. Migrate, in the order the code is to be rewritten: ninep/ctl.zig (its checks only), test/pdf.zig (step 3 of the pane-kinds plan), - pardes.zig and test/panes.zig, replica, the gui and tty shells, + pardes.zig and test/panes.zig, replica, the gui and tui shells, host_io. A migrated test must fail on a build broken on purpose. 3. Gaps: a test for each documented behaviour with none. 4. Delete the M and X tests the new ones cover. diff --git a/docs/render-pipeline.md b/docs/render-pipeline.md index 9d41f7fa..ba5d131e 100644 --- a/docs/render-pipeline.md +++ b/docs/render-pipeline.md @@ -27,7 +27,7 @@ Ticks (`Event.tick`) are produced by six different clocks: | shell | who ticks | cadence | |---|---|---| -| tty | `tickWatch` thread: nanosleep 16 ms **after** the wait asked, then `postEvent(.tick)` (tty.zig:1513) | 16 ms + frame time: drifts slow, worse over ssh | +| tty | `tickWatch` thread: nanosleep 16 ms **after** the wait asked, then `postEvent(.tick)` (tui.zig:1513) | 16 ms + frame time: drifts slow, worse over ssh | | gui | `AnimationClock.due` in `postPresent` re-arms `now+16ms` (gui.zig:203, 221, 4095) | a tick only once ≥16 ms have passed since the re-arm: at 144 Hz every 3rd frame (20.8 ms) → animations ~25% slow; at 120 Hz every 2nd; a slow frame slows them further | | gui grid mode | every `poll_frame` while active (gui.zig ~4114) | as fast as the loop | | web | JS rAF fixed-step bank, capped (app.mjs:566) | correct average rate, always ticking | @@ -38,7 +38,7 @@ So the same animation runs at different speeds per shell. Everything counts 16 ms frames (`layout.Animation.frame_ms`, layout.zig:2041). Acknowledgement is also per shell: tty `postPresent` acks the tracks it drew -(tty.zig:1187), GUI acks then ticks (`finishPresentedAnimationFrame`), grid mode +(tui.zig:1187), GUI acks then ticks (`finishPresentedAnimationFrame`), grid mode acks `&.{}`, macOS acks via `pardes_frame_presented`, **web never acks**. ### 1.2 Core render (`Pardes.render`, pardes.zig:5950), in code order @@ -83,7 +83,7 @@ set `cell.hover`, 378-385 — a side channel for macOS glass). ### 1.4 Shells -- **tty** (tty.zig:1100): `panel_compositor.compose` rewrites cells for +- **tty** (tui.zig:1100): `panel_compositor.compose` rewrites cells for slide/zoom/dissolve/vertical → `paintCells` (win.clear + every cell) → kitty images (hidden while geometry moves) → cursor → `vx.render` (vaxis diffs against its last screen, wraps in sync 2026). Layers are ignored. @@ -698,8 +698,8 @@ character effects (ascii…typewriter) → not a GUI effect (terminal track). ### 9.2 Terminal track (tty, cell-native; separate, smaller) -Where: presentation-only cell rewrites in the tty shell after the canonical -grid (`tty/panel_compositor.zig` grows into the tty compositor), never in the +Where: presentation-only cell rewrites in the tui shell after the canonical +grid (`tui/panel_compositor.zig` grows into the tty compositor), never in the canonical grid, so 9P/goldens stay clean with effects off. Gated on truecolor (vaxis caps / COLORTERM) — static effects may quantise to 256, animated ones turn off below truecolor. Safe glyph set by default (░▒▓ ▀▄▌▐ ▖▗▘▝); diff --git a/docs/shared-libs.md b/docs/shared-libs.md index ce0c7d3f..0a78f207 100644 --- a/docs/shared-libs.md +++ b/docs/shared-libs.md @@ -13,7 +13,7 @@ The policy (2026-09-24): would clobber a patch made in zig-pkg. - **This file lists what is shared, and where the policy could not be met.** -`zig build shared-libs-check -Dplatform=tty|gui` (it also runs with every +`zig build shared-libs-check -Dplatform=tui|gui` (it also runs with every `unit-test`) reads the linked binary's ELF symbol table. It fails when a family the build chose against is linked again: stb_image's PNG, JPEG or inflate beside wuffs, a second stb_image, stb_image_write's deflate, a second zlib, or diff --git a/docs/site/README b/docs/site/README index 41804163..2a9989ff 100644 --- a/docs/site/README +++ b/docs/site/README @@ -15,13 +15,13 @@ docs/site: the pardes website, built from docs/typ is true it shows placeholder.svg instead. casts/casts.toml the terminal recordings (asciicast v2), in order: name, title, caption, cols, rows, ready; casts/N.cast each. - test/record_casts.py records them from a tty pardes + test/record_casts.py records them from a tui pardes and writes this file. Build (from the repo root): typst compile --root . --format bundle --features bundle,html docs/site/site.typ OUT - zig build site -Dplatform=tty --prefix DIR # DIR/share/doc/pardes/site/ + zig build site -Dplatform=tui --prefix DIR # DIR/share/doc/pardes/site/ Every page sits at the top of OUT and every link is relative, so the site works from file:// and from any static server. The only prose of the diff --git a/docs/typ/README b/docs/typ/README index 9d3913c0..d246c3ed 100644 --- a/docs/typ/README +++ b/docs/typ/README @@ -26,10 +26,10 @@ the topics, since the book and the HTML hold them all. Build (from the repo root): typst compile --ignore-system-fonts docs/typ/cheatsheet-a4.typ - zig build cheatsheet -Dplatform=tty --prefix DIR # DIR/share/doc/pardes/cheatsheet.pdf + zig build cheatsheet -Dplatform=tui --prefix DIR # DIR/share/doc/pardes/cheatsheet.pdf typst compile --root . --ignore-system-fonts docs/typ/book.typ typst compile --root . --format bundle --features bundle,html docs/site/site.typ OUT - zig build site -Dplatform=tty --prefix DIR # DIR/share/doc/pardes/site/ + zig build site -Dplatform=tui --prefix DIR # DIR/share/doc/pardes/site/ (--root . because book and HTML read the tutor from src/tutor.txt.) The contract for content files @@ -45,7 +45,7 @@ new function instead. word(w) a builtin or tag word, drawn as a chip on the tag's ground; a builtin links to its entry in the Builtins chapter wherever that chapter is in the same output. - #word("Save") #word("Tty+bash") + #word("Save") #word("Term+bash") key(k) one press, or a sequence of presses separated by spaces, drawn as one pill (Ctrl + w, g › g). Modifiers: Ctrl-, Alt-, Shift-. @@ -59,7 +59,7 @@ new function instead. #chord("B2", "B1") #chord("B1", "B2", "B3") tag(words, path:) a whole default tagline; words must be a default tag. - #tag("Save Tty Collapse Del", path: "/home/me/notes.txt") + #tag("Save Term Collapse Del", path: "/home/me/notes.txt") addr(a) a look address. #addr("file:12:5") file(p) a 9P path. #file("pane/N/addr") cmd(c) a shell line, as a block. #cmd("echo Save > $m/pane/$n/ctl") @@ -102,12 +102,12 @@ new function instead. Builtins -------- -builtins-tty.json and builtins-gui.json are every builtin of the terminal +builtins-tui.json and builtins-gui.json are every builtin of the terminal and the window build (name, leader, Help's other shortcuts, arg, scope, -setting, choices, doc), written by `zig build builtins-json -Dplatform=tty` +setting, choices, doc), written by `zig build builtins-json -Dplatform=tui` and `-Dplatform=gui` from the registry and the Help rows (src/builtins_json.zig). style.typ merges them, marking each word "both", -"tty" or "gui". The doc steps refresh their build's file first, and each +"tui" or "gui". The doc steps refresh their build's file first, and each build's unit-test fails when its file is stale. #word takes a name from either file. builtins.typ draws it as the glossary; `everyday`, `internals` and `builtin-groups` in style.typ say diff --git a/docs/typ/building.typ b/docs/typ/building.typ index c6ca4e36..24229f08 100644 --- a/docs/typ/building.typ +++ b/docs/typ/building.typ @@ -17,7 +17,7 @@ builds MuPDF and is on by default (`-Dmupdf=false` drops it). 9P over QUIC #pairs( [`zig build`], [the terminal shell and the SDL window together, *installed into `~/.local/bin`* (`pardes` and `pardes-gui`)], - [`zig build -Dplatform=tty`], [the terminal shell alone], + [`zig build -Dplatform=tui`], [the terminal shell alone], [`zig build -Dplatform=gui`], [the SDL3 window alone], [`zig build web -Dplatform=web -Dtarget=wasm32-freestanding -Ddump=<file>`], [a freestanding wasm core plus vanilla JavaScript (`docs/web.md`)], [`zig build -Dplatform=macos`], [an AppKit and CoreText app over a static `libpardes.a` (`docs/macos.md`)], @@ -45,7 +45,7 @@ there; its namespace is in `src/esp32p4_gpio.zig`. `zig build --help` lists the options for the selected platform. #pairs( - [`-Dplatform`], [`tty`, `gui`, `web`, `macos`, `esp32p4`; absent: the tty and SDL shells together, installed into `~/.local`], + [`-Dplatform`], [`tui`, `gui`, `web`, `macos`, `esp32p4`; absent: the tui and SDL shells together, installed into `~/.local`], [`-Dstatic`], [bool, `false`], [`-Dquic`], [bool, `false`: 9P over QUIC with system OpenSSL 3.6+], [`-Dmupdf`], [bool; on natively, off for web and esp32p4], @@ -75,7 +75,7 @@ zig build core-test core tests without native shell tests zig build pane-test pane, output, PDF and namespace integration tests zig build kitty-test kitty graphics conformance of terminal panes, at the core zig build kitty-harness kitty graphics through a pane end to end (a fake kitty - terminal outside on the tty, the GPU capture on the gui; + terminal outside on the tui, the GPU capture on the gui; kitten icat and chafa too when installed) zig build syntax-test tree-sitter tests without building the editor zig build syntax deterministic per-byte highlighting snapshots @@ -104,7 +104,7 @@ zig build cheatsheet render the cheatsheet PDF (needs typst) reading its diff, never all), `snap -- --no-retry` makes the first failure decisive. Snapshot scripts can use `snap9p` to capture core cells through 9P. -- `zig build monkey -Dplatform=tty -- <seeds> [steps] [--from=N] [--out=DIR] [--keep]` writes one random script per seed and keeps any +- `zig build monkey -Dplatform=tui -- <seeds> [steps] [--from=N] [--out=DIR] [--keep]` writes one random script per seed and keeps any that panics; a seed always makes the same script. Each crash found gets a fix and a regression script in `test/snapshots/`. - The tutor's practice blocks (`# keys:`, `# before`, `# after` in @@ -126,10 +126,10 @@ zig build cheatsheet render the cheatsheet PDF (needs typst) == Release gates -A release passes all of these first: `unit-test` with `-Dplatform=tty` and +A release passes all of these first: `unit-test` with `-Dplatform=tui` and with `-Dplatform=gui`, `core-test`, `behaviour-test`, `process-test`, `snap`, the GUI goldens (`python3 -B test/gui_golden.py <a Debug pardes-gui>`, a hidden window), -`web`, and the ReleaseSafe tty and ReleaseFast gui builds. The committed +`web`, and the ReleaseSafe tui and ReleaseFast gui builds. The committed `docs/typ/cheatsheet-a4.pdf` is rendered again when the docs change. = Sending patches <patches> @@ -142,7 +142,7 @@ Mail patches to the list `~gbrls/[email protected]`; it is the preferred way to = The core and its shells -One core, five shells (tty, gui, web, macos, esp32p4). The core owns +One core, five shells (tui, gui, web, macos, esp32p4). The core owns editing, layout, rendering and the virtual filesystem it serves over 9P; a shell turns native input into `pardes.Event`, presents `pardes.Surface`, and performs host effects such as spawning processes. @@ -165,7 +165,7 @@ effects such as spawning processes. that the tests use. Comptime decides what a build has (`pardes.platform`, `hosted`, `can_attach`, `terminal_panes`, `pdf_enabled`); the vtable decides who serves it. -- The root module is chosen by platform: `main.zig` (tty, gui), +- The root module is chosen by platform: `main.zig` (tui, gui), `web.zig`, `macos.zig`, `esp32p4.zig`. The web and macOS shells are libraries whose host owns `main()`. - `memory.limits` is the one home for capacities that differ on the ESP32-P4 diff --git a/docs/typ/builtins-gui.json b/docs/typ/builtins-gui.json index c7553186..a78c2af0 100644 --- a/docs/typ/builtins-gui.json +++ b/docs/typ/builtins-gui.json @@ -137,6 +137,7 @@ {"name": "Tab", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "A tab's width in cells, 1 through 16, in every pane; bare, it says the width."}, {"name": "Tagbottom", "leader": "SPC t b", "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "Each pane's tag goes at its foot rather than its head, on or off."}, {"name": "TaglineSize", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Scale the tag font, a percentage."}, + {"name": "Term", "leader": "SPC n t", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "A shell in the calling pane's directory, raw from the first frame."}, {"name": "TermImages", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "real, petscii", "doc": "How a new terminal draws its program's kitty graphics: real, as pixels where it can, or petscii, as glyph art."}, {"name": "Theme", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Switch to the named theme."}, {"name": "ThemeFile", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Load a theme from a file."}, @@ -145,7 +146,6 @@ {"name": "Togglettymode", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Switch this terminal between raw program input and normal editor mode."}, {"name": "TreeContext", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Show the declarations enclosing the top row at the pane's head, on or off."}, {"name": "TreeContextTagStyle", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "A pane's TreeContext rows draw in the tag's style, on or off."}, - {"name": "Tty", "leader": "SPC n t", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "A shell in the calling pane's directory, raw from the first frame."}, {"name": "Tutor", "leader": "SPC h t", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the tutor, a document to work through."}, {"name": "Unattach", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Unattach a pane from the pane it answers for: it stays where it is, a pane of its own, and the next search from that pane opens another under it."}, {"name": "Undo", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "acme's Undo and Redo: step the pane's body back or forward through its edits, from a tag, a pane ctl or exec."}, diff --git a/docs/typ/builtins-tty.json b/docs/typ/builtins-tui.json index 613627a7..7592a745 100644 --- a/docs/typ/builtins-tty.json +++ b/docs/typ/builtins-tui.json @@ -120,6 +120,7 @@ {"name": "SyntaxBold", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "Keywords and the like are drawn bold, on or off."}, {"name": "Tab", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "A tab's width in cells, 1 through 16, in every pane; bare, it says the width."}, {"name": "Tagbottom", "leader": "SPC t b", "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "Each pane's tag goes at its foot rather than its head, on or off."}, + {"name": "Term", "leader": "SPC n t", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "A shell in the calling pane's directory, raw from the first frame."}, {"name": "TermImages", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "real, petscii", "doc": "How a new terminal draws its program's kitty graphics: real, as pixels where it can, or petscii, as glyph art."}, {"name": "Theme", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Switch to the named theme."}, {"name": "ThemeFile", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Load a theme from a file."}, @@ -128,7 +129,6 @@ {"name": "Togglettymode", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Switch this terminal between raw program input and normal editor mode."}, {"name": "TreeContext", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Show the declarations enclosing the top row at the pane's head, on or off."}, {"name": "TreeContextTagStyle", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "A pane's TreeContext rows draw in the tag's style, on or off."}, - {"name": "Tty", "leader": "SPC n t", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "A shell in the calling pane's directory, raw from the first frame."}, {"name": "Tutor", "leader": "SPC h t", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the tutor, a document to work through."}, {"name": "Unattach", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Unattach a pane from the pane it answers for: it stays where it is, a pane of its own, and the next search from that pane opens another under it."}, {"name": "Undo", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "acme's Undo and Redo: step the pane's body back or forward through its edits, from a tag, a pane ctl or exec."}, diff --git a/docs/typ/builtins.typ b/docs/typ/builtins.typ index 8375d5de..be069823 100644 --- a/docs/typ/builtins.typ +++ b/docs/typ/builtins.typ @@ -1,5 +1,5 @@ // Every builtin: the words you click in a tag (Exec runs them) or type as -// commands. The entries come from docs/typ/builtins-tty.json and +// commands. The entries come from docs/typ/builtins-tui.json and // builtins-gui.json, which // `zig build builtins-json` writes from the registry and the Help rows, // so this chapter and Help cannot drift. diff --git a/docs/typ/cheatsheet.typ b/docs/typ/cheatsheet.typ index a70b56e2..0e984efe 100644 --- a/docs/typ/cheatsheet.typ +++ b/docs/typ/cheatsheet.typ @@ -25,10 +25,10 @@ One button: Alt/Option-click is #btn("B2"), Cmd/Super-click #btn("B3"), sweeps t == Tags #tag("Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit") -#tag("New Tty Find Grep Joincol Delcol") -#tag("Save Tty Collapse Del", path: "/home/me/notes.txt") -#tag("Tty+bash Save Mode Filter Collapse Del", path: "/home/me/src") -#tag("Tty PdfSections PdfTint PdfFit Collapse Del", path: "manual.pdf [1/12]") +#tag("New Term Find Grep Joincol Delcol") +#tag("Save Term Collapse Del", path: "/home/me/notes.txt") +#tag("Term+bash Save Mode Filter Collapse Del", path: "/home/me/src") +#tag("Term PdfSections PdfTint PdfFit Collapse Del", path: "manual.pdf [1/12]") - #word("Del") over unsaved text refuses once; again discards. #word("Del") `j`: rows below. #key("SPC d") between two panes takes #key("k") (rows above) or #key("j") (below), asking only if you pause. - #word("Undo") #word("Redo") #word("Edit") #word("Mode") work typed anywhere. #doc("tags") @@ -91,7 +91,7 @@ Helix-style: motions *select*, then an edit acts on the selection. Mode box: bla key("SPC s s"), [declarations], key("SPC f c"), word("Config"), key("SPC d"), word("Del"), - key("SPC n t"), word("Tty"), + key("SPC n t"), word("Term"), key("SPC w"), word("Window"), key("SPC j j"), word("Last"), key("SPC j l"), word("Jumplist"), @@ -111,7 +111,7 @@ Helix-style: motions *select*, then an edit acts on the selection. Mode box: bla ) == Terminals and commands -- #key("Ctrl-b"): raw (`$`) or normal. #word("Mode") cycles raw, normal, insert. #word("Filter"), #word("Tty+bash"). +- #key("Ctrl-b"): raw (`$`) or normal. #word("Mode") cycles raw, normal, insert. #word("Filter"), #word("Term+bash"). - #btn("B2") on a non-builtin line runs it in a *command pane*: #tag("Kill Save Collapse Del", path: "/home/me/src (make) exit 0") - #word("Kill") `make` stops it; #word("Exit") quits. #word("Repl") `python`: `.py` clicks go to it. diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ index 74a0df86..d45f5cc5 100644 --- a/docs/typ/guide.typ +++ b/docs/typ/guide.typ @@ -32,7 +32,7 @@ Each pane keeps its own mode. The box left of its tag shows it. #pairs( [#mode-box(" ") normal], [keys move and select; an edit acts on the selection. File and PDF panes start here, and so does a terminal from #key("Alt-n").], [#mode-box("^") insert], [keys type. #keys("i", "a", "o") and the rest enter it.], - [#mode-box("$") raw, terminals only], [keys go to the program. A terminal from #word("Tty"), the shell a bare `pardes` starts with, and a command pane start here.], + [#mode-box("$") raw, terminals only], [keys go to the program. A terminal from #word("Term"), the shell a bare `pardes` starts with, and a command pane start here.], ) #key("Ctrl-b") switches a terminal between raw and normal. In normal, @@ -93,8 +93,8 @@ the registers. #key("SPC y") and #key("SPC p") use the system clipboard. = Tags <tags> #tag("Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit") -#tag("New Tty Find Grep Joincol Delcol") -#tag("Save Tty Collapse Del", path: "/home/me/notes.txt") +#tag("New Term Find Grep Joincol Delcol") +#tag("Save Term Collapse Del", path: "/home/me/notes.txt") A tag is text with undo. Type `make` into one and #word("Exec") it, or delete the words you never use. Any word runs from any tag: #word("Exit") @@ -227,10 +227,10 @@ do nothing. = Terminals <terminals> -#tag("Tty+bash Save Mode Filter Collapse Del", path: "/home/me/src") +#tag("Term+bash Save Mode Filter Collapse Del", path: "/home/me/src") -- #word("Tty") opens a terminal in the pane's directory, #key("Alt-n") one in - the session's directory; #word("Tty+bash") picks the shell. +- #word("Term") opens a terminal in the pane's directory, #key("Alt-n") one in + the session's directory; #word("Term+bash") picks the shell. - #word("Del") closes a terminal and its shell at once, running or not, and a shell that exits closes its pane. - #word("Save") writes the scrollback to a path it asks for. diff --git a/docs/typ/install.typ b/docs/typ/install.typ index d97d30f7..7489d069 100644 --- a/docs/typ/install.typ +++ b/docs/typ/install.typ @@ -20,6 +20,6 @@ With Zig 0.17 (the build fetches everything else; once that is downloaded, a first build from a clean cache took 62 seconds on 16 cores): -#cmd("# pardes, in a terminal\nzig build -Dplatform=tty --prefix ~/.local") +#cmd("# pardes, in a terminal\nzig build -Dplatform=tui --prefix ~/.local") #cmd("# pardes-gui, its own window\nzig build -Dplatform=gui --prefix ~/.local") Then run `pardes` or `pardes FILE`. diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index b272306c..0669780a 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -39,7 +39,7 @@ tagexec a word clicked in the workspace tag @co col/ the columns @columns-and-tags <n>/ column <n>; rmdir closes it when empty @columns-and-tags tag its tag - ctl its builtins (Delcol Joincol New Tty) + ctl its builtins (Delcol Joincol New Term) exec a word clicked in its tag pane/ the panes @panes new open it to make a pane; read answers the serial @panes @@ -291,6 +291,7 @@ A line written to #file("exec") is #word("Exec"): `Abort`) are refused, `invalid: acme's Snarf is not a pardes builtin: ...`, never run as commands. So is a GUI-only builtin (#word("Fonts")) on another frontend. +- `Tty` is #word("Term")'s old name, run as it, `Tty+fish` too. - Anything else is a command line (a typo ends `exit 127`), at most 1024 bytes, run as the guide says (#doc("tags", section: "command-panes")): typed into a terminal idle at an empty prompt, else run in a command pane. #file("exec") reads back @@ -399,7 +400,7 @@ Writes take settings and session builtins (`scope = .session` in rows (`size: too small for the panes, each its tag and 2 rows`). A bad `size` is refused quoting the value it got (`"5 2"`). -A word that takes its argument after a `+` (#word("Tty+bash")) works on a ctl as +A word that takes its argument after a `+` (#word("Term+bash")) works on a ctl as in a tag. A write is refused whole, before anything runs, in Plan 9's words: `unknown control message "X"`, `wrong #args in control message "X"`, `bad value in control message ...`, or a word of the other ctl: `not a session control message "Undo": write it to pane/<n>/ctl`, `... "Delcol": write it to col/<serial>/ctl`, `not a window control message "X": write it to /ctl`. A builtin that would open a prompt (#word("Save") on a scratch) @@ -431,7 +432,7 @@ word clicked in a tag does. The same lines go in the startup file [#word("LookWord") `search|list`], [`search`: a word given to #word("Look") selects its next place, or lists all in `+Search`], [#word("DirLook") `pane|terminal`], [`pane`: #word("Look") on a directory opens a pane listing it, as acme's directory window (#doc("reference", section: "from-acme")); `terminal` types `ls` into a terminal idle there, else opens one], [#word("JumpScope") `file|all`], [`file`: #word("Back") and #word("Forward") keep to the focused pane's file, that pane's places first, then the file's in another pane, and go to another file only when the file has no place left that way; from a terminal or a pane with no file they step through every place; `all`: every place, in the order it was jumped to], - [#word("TermImages") `real|petscii`], [`real`: a new terminal draws its program's kitty graphics (yazi's previews) as pixels where the shell can; #word("Petscii") flips one terminal; a tty under a terminal without kitty graphics draws them as glyph art either way], + [#word("TermImages") `real|petscii`], [`real`: a new terminal draws its program's kitty graphics (yazi's previews) as pixels where the shell can; #word("Petscii") flips one terminal; a tui under a terminal without kitty graphics draws them as glyph art either way], [#word("Shell") `<name or path>`], [`$SHELL` when it is executable, else `/bin/sh`: the shell the next terminal and command pane run; a bare name is searched for in the usual bin directories, not `$PATH`; bare #word("Shell"): `$SHELL` if it is executable, else `/bin/sh`], [#word("DumpDir") `<dir>`], [`$XDG_DATA_HOME/pardes`, else `~/.local/share/pardes`: where #word("Dump") writes, an absolute or `~` path to a directory that may be written (made if missing); a relative one, or one under a directory that may not be written, is refused; bare returns to the default], [#word("TreeContext")], [off: sticky declaration headers in a source pane (per pane, dumped)], @@ -500,7 +501,7 @@ and leave one under its tag and two rows (`Newcol: no space for a column: the pa alone and uses up no column serial. #file("/col/<n>/ctl") takes #word("Delcol"), #word("Joincol"), -#word("New") and #word("Tty") for that column; #file("/col/<n>/exec") is +#word("New") and #word("Term") for that column; #file("/col/<n>/exec") is a click in its tag; `rmdir /col/<n>` closes an empty column (one with panes: ENOTEMPTY). Closing a column's last pane leaves it empty (the keyboard goes to its tag, #file("focus") reads empty, the log says only @@ -534,7 +535,7 @@ tag would (#doc("fs", section: "placement")): in the active column, filling it if empty, else the bottom half of its last pane. A session holds 64 panes (`no space for a pane: 64 max`), and every pane keeps its tag and 2 rows (`no space for a pane in that column: each keeps its tag and 2 rows`); both are ENOSPC, for this open and for #word("Look"), #word("Exec"), -#word("New") or #word("Tty") alike. A #file("pane/new") whose column is +#word("New") or #word("Term") alike. A #file("pane/new") whose column is full takes its rows from a pane in another column that has them, last column first, as acme does, and is refused only when no pane anywhere can give them. `rmdir /pane/<n>` closes the pane, unsaved or not. @@ -608,7 +609,7 @@ takes: below), #word("Save") `[path]` (bare, on a `+`-named pane that is no output, such as `+Tutor`, it asks for a path; making the directories the file goes in first, whichever name it writes), #word("Collapse"), #word("Undo")/#word("Redo") - (256 steps each), #word("Find") `pat`, #word("Edit") `...`, #word("Tty") `[shell]` (a new terminal + (256 steps each), #word("Find") `pat`, #word("Edit") `...`, #word("Term") `[shell]` (a new terminal in its directory), #word("Delcol") for its column, and #word("Left")/#word("Right")/#word("Up")/#word("Down"), which give the keyboard to the pane beside it that way, up from a column's top pane to @@ -988,7 +989,7 @@ asked, else the active column (last typed or left-clicked in, dropped into, its tag given the keyboard, or given the last new pane), never a new column. An empty column it takes whole; #word("New") and #file("pane/new") take the bottom half of the column's last pane; a pane -opened from a pane's text (#word("Look"), #word("Tty"), #key("Alt-n")) goes under +opened from a pane's text (#word("Look"), #word("Term"), #key("Alt-n")) goes under the pane with the most blank rows, or halves the biggest. #word("New") in a pane's tag names its `+New` in that pane's directory and column; from a column tag, in that column and the session's directory. A command pane @@ -1162,7 +1163,7 @@ with Client(sys.argv[1]) as c: # a socket path, or (ip, port) [`Font`, `Send`, `ID`], [#word("Font"); #word("Repl") and #word("Exec"); `$winid`], [acme's other builtins], [refused: `Sort`, `Local`, `Abort` (plan9port's debugging word)], [Edit], [every acme command but `B <cmd`, `D <cmd` and the `'` address; no `\1`-`\9`, and an alternation takes the first branch that matches, not the longest; a failing `< | >` command changes nothing, where acme puts in what it wrote (#doc("fs", section: "edit"))], - [`win`], [#word("Tty") is a VT terminal pane; #file("pty/run") runs a line at its prompt and answers `exit N` and the output; with #word("Repl") bound, #word("Exec") on a source pane types the text into it], + [`win`], [#word("Term") is a VT terminal pane; #file("pty/run") runs a line at its prompt and answers `exit N` and the output; with #word("Repl") bound, #word("Exec") on a source pane types the text into it], [a directory window], [as acme's: a text pane named `dir/` (#file("index") kind `text`, #file("ctl") isdir 1), its entries in columns sorted bytewise, dotfiles shown, a directory's marked `/`; blanks pad the columns where acme's tabs do; a #word("Look") at an entry is from that directory, `Get` or a look at it again reads it again, and an edit is kept until then rather than lost to a resize; never dirty, #word("Save") refuses it; #word("DirLook") `terminal` types `ls` into a terminal there instead], [the plumber], [none: #word("Look") on an `http://` or `https://` URL runs `xdg-open` (`open` on macOS); files, addresses and directories follow built-in rules], [#key("Esc") selects what was typed], [#key("Esc") leaves insert mode, or goes back a pane (#doc("tags", section: "modes"))], diff --git a/docs/typ/style.typ b/docs/typ/style.typ index b5c2ff85..e2eafc87 100644 --- a/docs/typ/style.typ +++ b/docs/typ/style.typ @@ -186,16 +186,16 @@ /// Every builtin of either build, written by `zig build builtins-json` /// from the registry and the Help rows (src/builtins_json.zig), a file per /// build: name, leader, also (Help's other shortcuts), arg, scope, setting, -/// choices, doc. Merged here, each with `platforms`: "both", "tty" (the +/// choices, doc. Merged here, each with `platforms`: "both", "tui" (the /// terminal only) or "gui" (the window only). #let builtin-data = { - let tty = json("builtins-tty.json") + let tui = json("builtins-tui.json") let gui = json("builtins-gui.json") - let in-tty = tty.map(b => b.name) + let in-tui = tui.map(b => b.name) let in-gui = gui.map(b => b.name) - let all = (tty + gui.filter(b => b.name not in in-tty)).sorted(key: b => b.name) + let all = (tui + gui.filter(b => b.name not in in-tui)).sorted(key: b => b.name) all.map(b => { - b.insert("platforms", if b.name in in-tty and b.name in in-gui { "both" } else if b.name in in-tty { "tty" } else { "gui" }) + b.insert("platforms", if b.name in in-tui and b.name in in-gui { "both" } else if b.name in in-tui { "tui" } else { "gui" }) b }) } @@ -367,7 +367,7 @@ /// The newcomer's words, first in the glossary; every other builtin goes /// under its group below. Each must be in builtins.json. #let everyday = ("Look", "Exec", "Save", "Undo", "Redo", "New", "Newcol", "Del", "Delcol", - "Tty", "Kill", "Find", "Grep", "Recent", "Dump", "Restore", "Exit", "Help", "Tutor", "Themes", "Config") + "Term", "Kill", "Find", "Grep", "Recent", "Dump", "Restore", "Exit", "Help", "Tutor", "Themes", "Config") /// Debugging and developer words, last whatever their leader path. #let internals = ("Debug", "EffectCode", "Lspwhy", "Messages", "DumpConfig", "DumpThemes") diff --git a/docs/typ/themes.typ b/docs/typ/themes.typ index edfaa7ad..6dc92b3b 100644 --- a/docs/typ/themes.typ +++ b/docs/typ/themes.typ @@ -39,7 +39,7 @@ syntax identity but are not exact ports; their sources are in pane's and column's tags shift tone on tone rather than invert: dark palettes keep dark tags, light ones light tags. The file name in a pane's path, and `+Search` and the like, take a distinct hue at the same -brightness as the tag text; a terminal's tag tints its #word("Tty") word +brightness as the tag text; a terminal's tag tints its #word("Term") word instead. Every native palette sets its own ANSI colours, so a terminal's indexed @@ -110,7 +110,7 @@ take `null`, so older files stay valid: #pairs( [`tag_active_bg`, `tag_active_fg`], [the focused pane's tag; a ground closer than 1.25:1 to `tag_bg` is pushed further the way it leans, as far as its text keeps its contrast. Absent: `tag_bg`, `tag_fg`], - [`tag_name_fg`, `tag_active_name_fg`], [the file name's or a terminal's #word("Tty") tint, in normal and focused tags. Absent: the tag's foreground], + [`tag_name_fg`, `tag_active_name_fg`], [the file name's or a terminal's #word("Term") tint, in normal and focused tags. Absent: the tag's foreground], [`column_box`, `column_box_dim`], [a column's grip held (and its drag rail), and at rest. Absent: `num`; a mix of `column_box` and `tag_bg`], [`border`], [quiet separators, lifted to 1.6:1 when under 1.5:1 off the page. Absent: `scroll_track`], [`empty_col`], [a column with no pane, under its tag (acme: white). Absent: `border`], diff --git a/docs/ui-review.md b/docs/ui-review.md index 2d785ed8..5c15e950 100644 --- a/docs/ui-review.md +++ b/docs/ui-review.md @@ -41,7 +41,7 @@ sent to the user's session. ## Compact rails, classic palettes and workspace pets `New` now belongs to column tags only. Pane tags keep their local save, -terminal and close actions: `Tty` opens a terminal, and `Mode` +terminal and close actions: `Term` opens a terminal, and `Mode` cycles raw input, normal editing and insert mode. Historical default pane tails upgrade during Restore; explicitly customized text remains owned by the user. @@ -83,7 +83,7 @@ the native contrast tests. ## PDF and terminal tag cleanup -PDFs now use `filename.pdf [page/total] Tty Del PdfSections PdfTint PdfFit Collapse`, +PDFs now use `filename.pdf [page/total] Term Del PdfSections PdfTint PdfFit Collapse`, keeping sections and tint commands visible without the long generated control/status prefix. Terminal tags include `Mode`, which cycles the body mode even when invoked from an edited tag. Ctrl-B keeps its two-way toggle. @@ -101,10 +101,10 @@ The follow-up adds editable workspace and column command rows, compact pane tags, staged buffer-name edits, and caret reveal for long tags. See [editable tags](typ/guide.typ) for the exact interaction and save-target rules. -`test/column_tags.py` exercises isolated SDL and TTY sessions against the same +`test/column_tags.py` exercises isolated SDL and TUI sessions against the same Agave source. It sends actual host input bytes while observing through 9P: header typing and selection replacement, UTF-8 deletion, inactive-column -`New`/`Tty`, pane-tail edits, filename cancellation, terminal input, and +`New`/`Term`, pane-tail edits, filename cancellation, terminal input, and custom-tag Dump/Restore. Source bytes remain unchanged. Input goes through the host PTY parser; compact SDL pixel coordinates are covered separately by round-trip mapping tests, not claimed as physical SDL mouse automation. @@ -175,7 +175,7 @@ python3 -B test/ui_review.py zig-out/ui-review/bin/pardes-gui \ For subsequent palette captures, add `--skip-lsp`. To repeat LSP work without rebuilding dependencies, use `--cargo-target /path/to/previous/cargo-target`. Cargo runs offline and stores build output in that isolated directory. -For the TTY pass, use the TTY binary and add `--tty`. The script requires +For the TUI pass, use the TUI binary and add `--tty`. The script requires Find/Grep results and observed terminal output, fails missing or malformed SDL captures, and writes `report.json` with the actual outcomes. LSP absence or failure is recorded separately rather than passing as a successful popup. 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` diff --git a/test/agent_session.py b/test/agent_session.py index aa87c845..8a62bf26 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=['--tty', '--9p=agent-session'], + socket_name='agent-session', launch=['--tui', '--9p=agent-session'], inherited={'PARDES_TEST_GRID': '1'} if args.gui_grid else {}) client, _ = context.__enter__() try: diff --git a/test/appearance_gallery.py b/test/appearance_gallery.py index 98420a15..8672de71 100644 --- a/test/appearance_gallery.py +++ b/test/appearance_gallery.py @@ -16,7 +16,7 @@ THEMES = ('forge', 'lagoon', 'solarium', 'spectrum', 'harvest', 'clay') NOTES = b'''Pardes / workspace review New belongs to the column. -Tty opens a terminal. +Term opens a terminal. Mode switches its input mode. Font MartianMono-NrRg:18 @@ -84,7 +84,7 @@ def run(args): client.write(f'/pane/{right}/body', PREFERENCE_NOTES if args.theme_selector else NOTES, truncate=True) client.write(f'/pane/{right}/dirty', b'0\n') before = set(panes(client)) - command(client, right, 'Tty') + command(client, right, 'Term') terminal = require(wait_for(lambda: next((s for s in panes(client) if s not in before), None)), 'terminal missing') client.write(f'/pane/{terminal}/pty/data', b"PS1='$ '; printf '\\033[2J\\033[H\\033[1;36mPardes workspace\\033[0m\\n\\n'; printf 'Agave source: read-only\\nTerminal: ready\\n\\n'; printf '\\033[32mSmall touches. Same workflow.\\033[0m\\n'\r") require(wait_for(lambda: b'Small touches. Same workflow.' in client.read(f'/pane/{terminal}/body')), 'terminal output missing') diff --git a/test/behaviour/columns_and_tags.zig b/test/behaviour/columns_and_tags.zig index 22f55774..d5820610 100644 --- a/test/behaviour/columns_and_tags.zig +++ b/test/behaviour/columns_and_tags.zig @@ -57,11 +57,11 @@ test "columns-and-tags: Newcol makes an empty column with the keyboard on its ta const left, const col = .{ try s.column(0), try s.column(1) }; try expectEqualStrings(s.at("{d}:{d} {d}:", .{ left, first, col }), try s.columns()); try s.expect("/focus", ""); - try s.write(s.at("/pane/{d}/exec", .{first}), "Tty\n"); + try s.write(s.at("/pane/{d}/exec", .{first}), "Term\n"); const shell = try s.focused(); try expectEqualStrings(s.at("{d}:{d} {d}:{d}", .{ left, first, col, shell }), try s.columns()); - // The next Tty splits as it always has: nothing is empty any more. - try s.write(s.at("/pane/{d}/exec", .{shell}), "Tty\n"); + // The next Term splits as it always has: nothing is empty any more. + try s.write(s.at("/pane/{d}/exec", .{shell}), "Term\n"); try expectEqualStrings(s.at("{d}:{d} {d}:{d},{d}", .{ left, first, col, shell, try s.focused() }), try s.columns()); } @@ -160,7 +160,7 @@ test "columns-and-tags: New is a column tag's word, in no pane's tag nor the wor var words = std.mem.tokenizeScalar(u8, tag, ' '); while (words.next()) |word| try std.testing.expect(!std.mem.eql(u8, word, "New")); } - try expectEqualStrings("New Tty Find Grep Joincol Delcol", try s.read(s.at("/col/{d}/tag", .{try s.column(0)}))); + try expectEqualStrings("New Term Find Grep Joincol Delcol", try s.read(s.at("/col/{d}/tag", .{try s.column(0)}))); } test "columns-and-tags: a click past a column tag's text types after it, a newline typed there a space, and a long tag scrolls to its caret" { @@ -168,12 +168,12 @@ test "columns-and-tags: a click past a column tag's text types after it, a newli defer s.deinit(); const tag = s.at("/col/{d}/tag", .{try s.column(0)}); // Its row, then the pane's tag: the column's stays one row. - const rows = " New Tty Find Grep Joincol Delcol"; + const rows = " New Term Find Grep Joincol Delcol"; try std.testing.expect(std.mem.indexOf(u8, try s.screen(), rows ++ " ") != null); try s.click("Delcol", 20, 1); // A clicked tag is in normal mode: `i` types where it was clicked. try s.keys("i\nSnarf"); - try expectEqualStrings("New Tty Find Grep Joincol Delcol Snarf", try s.read(tag)); + try expectEqualStrings("New Term Find Grep Joincol Delcol Snarf", try s.read(tag)); try std.testing.expect(std.mem.indexOf(u8, try s.screen(), rows ++ " Snarf ") != null); // The pane's tag on the row right under it: the column's is one row. try std.testing.expectEqual((try s.where(rows))[1] + 1, (try s.where("/test.txt Save"))[1]); @@ -265,7 +265,7 @@ test "columns-and-tags: a column tag lights the word under the mouse, is clicked try s.write("/mousein", s.at("m {d} 1 0\n", .{x})); const lit = try s.bg(x, 1); try std.testing.expect(!std.mem.eql(u8, plain, lit)); - try expectEqualStrings(plain, try s.bg(x + 4, 1)); // Tty, another word + try expectEqualStrings(plain, try s.bg(x + 4, 1)); // Term, another word // Pressed, the keyboard is on the tag, its caret where it was pressed. try s.write("/mousein", s.at("m {d} 1 1\n", .{x})); try s.expect("/focus", ""); @@ -277,7 +277,7 @@ test "columns-and-tags: a column tag lights the word under the mouse, is clicked try std.testing.expect(!std.mem.eql(u8, lit, try s.bg(x + 4, 1))); // A clicked tag is in normal mode: `i` types at its caret. try s.keys("\u{F00D}iHelp "); - try std.testing.expect(std.mem.startsWith(u8, try s.read(tag), "Help New Tty")); + try std.testing.expect(std.mem.startsWith(u8, try s.read(tag), "Help New Term")); try std.testing.expectEqual(x + 5, (try s.cursor()).?[0]); // A tag one short of its room: its caret at the end is drawn on the // last cell, and one more letter scrolls the text, never the caret. diff --git a/test/behaviour/look_and_exec.zig b/test/behaviour/look_and_exec.zig index c46ca394..ee9554cc 100644 --- a/test/behaviour/look_and_exec.zig +++ b/test/behaviour/look_and_exec.zig @@ -135,7 +135,7 @@ test "look-and-exec: look and exec read back what the last command touched, a ct try s.write("/exec", "Msg first\n"); try s.expect("/exec", s.at("{d}\n", .{n})); // A pane made through ctl is what both read next, not the Msg's pane. - try s.write(s.at("/pane/{d}/ctl", .{n}), "Tty\n"); + try s.write(s.at("/pane/{d}/ctl", .{n}), "Term\n"); const made = try s.focused(); try std.testing.expect(made != n); try s.expect("/exec", s.at("{d}\n", .{made})); @@ -159,7 +159,7 @@ test "look-and-exec: a line starting with # runs as nothing at an exec or a ctl, const log = try s.read("/log"); const col = std.mem.sliceTo(try s.read("/layout"), ' '); for ([_][]const u8{ "/exec", s.at("/pane/{d}/exec", .{n}), "/ctl", s.at("/pane/{d}/ctl", .{n}), s.at("/col/{s}/ctl", .{col}) }) |path| - try s.write(path, "# Platform: tty\n # indented too\n"); + try s.write(path, "# Platform: tui\n # indented too\n"); try s.expect("/index", index); try s.expect("/log", log); } diff --git a/test/behaviour/modes.zig b/test/behaviour/modes.zig index ba792086..961ca788 100644 --- a/test/behaviour/modes.zig +++ b/test/behaviour/modes.zig @@ -32,7 +32,7 @@ test "modes: Esc in a column or the workspace tag gives the keyboard back to a p var s = try Session.initFile(std.testing.allocator, "x\n"); defer s.deinit(); _ = try s.newPane(); - for ([_][]const u8{ "New Tty", "Newcol" }) |tag| { + for ([_][]const u8{ "New Term", "Newcol" }) |tag| { const was = try s.focused(); // A click puts the tag in normal mode, the keyboard there; Esc is // out of it. @@ -96,7 +96,7 @@ test "modes: Esc back into a file leaves its view where it was, and a look centr // The other arm still centres: a look's `:NN`. const line = 60; try s.write(s.at("/pane/{d}/look", .{doc}), s.at(":{d}\n", .{line})); - const rows = (try s.where("Tty Save Mode"))[1] - (try s.where("/test.txt"))[1] - 1; + const rows = (try s.where("Term Save Mode"))[1] - (try s.where("/test.txt"))[1] - 1; // Drawn mid-pane, a row either way. const drawn_at = line - try topLine(&s, "/test.txt"); try std.testing.expect(drawn_at + 1 >= rows / 2 and drawn_at <= rows / 2 + 1); @@ -468,7 +468,7 @@ test "modes: hopping between two panes by Esc, window mode or a click makes no p try expectEqual(want, try s.focused()); } const doc_row = (try s.where("row"))[1]; - const shell_row = (try s.where("Tty Save Mode"))[1] + 1; + const shell_row = (try s.where("Term Save Mode"))[1] + 1; for (0..8) |_| { const other = if (try s.focused() == doc) shell else doc; const row = if (other == doc) doc_row else shell_row; diff --git a/test/behaviour/mouse.zig b/test/behaviour/mouse.zig index d7da46e8..a0ac7a23 100644 --- a/test/behaviour/mouse.zig +++ b/test/behaviour/mouse.zig @@ -129,7 +129,7 @@ test "mouse: a B1 sweep over several lines is a stream, as acme's, in a body and const tx, const ty = try s.where("Collapse"); const lx, const ly = try s.where("Look Edit"); try mouse(&s, "m {d} {d} 1\nm {d} {d} 1\nm {d} {d} 3\nm {d} {d} 0\n", .{ tx + 3, ty, lx + 1, ly, lx + 1, ly, lx + 1, ly }); - try s.expect(tag, "/test.txt Save Tty Colok Edit"); + try s.expect(tag, "/test.txt Save Term Colok Edit"); } test "mouse: a click on either half of a wide character lands before it, in the text and on a tag's path, and the caret steps over it whole" { diff --git a/test/behaviour/tags.zig b/test/behaviour/tags.zig index 8609e134..71faed3a 100644 --- a/test/behaviour/tags.zig +++ b/test/behaviour/tags.zig @@ -41,9 +41,9 @@ test "tags: ms and md edit a tag's own text, and the text the edit made is read defer s.deinit(); const n = try s.focused(); try s.keys(":miwms("); - try std.testing.expectEqualStrings("/test.txt (Save) Tty Collapse Del", try tag(&s, n)); + try std.testing.expectEqualStrings("/test.txt (Save) Term Collapse Del", try tag(&s, n)); try s.keys("md("); - try std.testing.expectEqualStrings("/test.txt Save Tty Collapse Del", try tag(&s, n)); + try std.testing.expectEqualStrings("/test.txt Save Term Collapse Del", try tag(&s, n)); } test "tags: the keyboard reaches a tag's path, which it can select and yank but not edit" { @@ -66,7 +66,7 @@ test "tags: the keyboard reaches a tag's path, which it can select and yank but try s.expect(s.at("/pane/{d}/name", .{n}), "/test.txt\n"); // After the path, the text is the tag's own to edit. try s.keys(":A!\x1b"); - try std.testing.expectEqualStrings("/test.txt Save Tty Collapse Del!", try tag(&s, n)); + try std.testing.expectEqualStrings("/test.txt Save Term Collapse Del!", try tag(&s, n)); // What it yanked was the path. try s.keys(":P"); try s.expect(s.at("/pane/{d}/body", .{n}), "/test.txtbody\n"); @@ -102,7 +102,7 @@ test "tags: a tag remembers its cursor, starts on Save, and a click moves it" { try std.testing.expectEqual(@as(usize, 5), try tagCol(&s, "/second.txt")); try s.keys(":"); // A click in the tag puts its cursor there, the pane's keyboard with it. - try s.click("Save Tty", 6, 1); + try s.click("Save Term", 6, 1); try std.testing.expectEqual(first, try s.focused()); try std.testing.expectEqual(@as(usize, "/test.txt Save T".len), try tagCol(&s, "/test.txt")); // A prompt opened and left from the body leaves it there (a clicked @@ -187,7 +187,7 @@ test "tags: a tag's normal mode is the body's: motions stay in the tag and inser try s.keys(window ++ "h\n"); try std.testing.expectEqual(first, try s.focused()); try s.keys(":i\u{F018}hjklHJKL:"); - try std.testing.expectEqualStrings("/test.txt Save Tty Collapse DelhjklHJKL:", try tag(&s, first)); + try std.testing.expectEqualStrings("/test.txt Save Term Collapse DelhjklHJKL:", try tag(&s, first)); try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{first})), " mode:normal ")); try s.expect(s.at("/pane/{d}/body", .{first}), "body\n"); try std.testing.expectEqual(first, try s.focused()); @@ -202,7 +202,7 @@ test "tags: a tag with a newline in it is as tall as its lines, and each line is if (bottom) try s.write("/ctl", "Tagbottom on\n"); // Insert mode in a tag is a body's: Enter is a new line. try s.keys(":A\nSecond"); - try std.testing.expectEqualStrings("/test.txt Save Tty Collapse Del\nSecond", try tag(&s, n)); + try std.testing.expectEqualStrings("/test.txt Save Term Collapse Del\nSecond", try tag(&s, n)); const x, const y = try s.where("/test.txt"); try std.testing.expectEqual(.{ x, y + 1 }, try s.where("Second")); // The caret is on the second line, after what was typed. @@ -216,7 +216,7 @@ test "tags: a tag with a newline in it is as tall as its lines, and each line is try std.testing.expectEqual(.{ x + 2, y + 1 }, (try s.cursor()).?); // A clicked tag is in normal mode: `i` types where it was clicked. try s.keys("iX"); - try std.testing.expectEqualStrings("/test.txt Save Tty Collapse Del\nSeXcond", try tag(&s, n)); + try std.testing.expectEqualStrings("/test.txt Save Term Collapse Del\nSeXcond", try tag(&s, n)); try s.expect(s.at("/pane/{d}/body", .{n}), "body\n"); } } @@ -311,14 +311,14 @@ test "tags: a name drafted in the tag commits with Enter, cancels with two Escs, try clickPathEnd(&s, path); try s.keys("\x15/new name.zig"); try s.expect(name, s.at("{s}\n", .{path})); - _ = try s.where("/new name.zig Save Tty Collapse Del SyntaxBold"); + _ = try s.where("/new name.zig Save Term Collapse Del SyntaxBold"); try s.expect(s.at("/pane/{d}/body", .{n}), "original body\n"); // Esc keeps the draft pending; a second drops it. try s.keys(if (commit) "\n" else "\x1b\x1b"); try s.expect(name, if (commit) "/new name.zig\n" else "/test.txt\n"); - try std.testing.expectEqualStrings(s.at("{s} Save Tty Collapse Del SyntaxBold", .{if (commit) "/new name.zig" else "/test.txt"}), try tag(&s, n)); + try std.testing.expectEqualStrings(s.at("{s} Save Term Collapse Del SyntaxBold", .{if (commit) "/new name.zig" else "/test.txt"}), try tag(&s, n)); // The keyboard is the body's again. - try std.testing.expect((try s.cursor()).?[1] != (try s.where("Save Tty"))[1]); + try std.testing.expect((try s.cursor()).?[1] != (try s.where("Save Term"))[1]); } try std.testing.expectEqual(@as(usize, 0), s.saved); // A name alone is no edit: the pane stays clean. @@ -365,9 +365,9 @@ test "tags: middle clicking Save commits the drafted name before saving" { const n = try s.focused(); try clickPathEnd(&s, "/test.txt"); try s.keys("\x15/renamed.txt"); - try s.click("Save Tty", 0, 2); + try s.click("Save Term", 0, 2); try s.expect(s.at("/pane/{d}/name", .{n}), "/renamed.txt\n"); - try std.testing.expectEqualStrings("/renamed.txt Save Tty Collapse Del", try tag(&s, n)); + try std.testing.expectEqualStrings("/renamed.txt Save Term Collapse Del", try tag(&s, n)); try s.expect(s.at("/pane/{d}/body", .{n}), "untouched\n"); try std.testing.expectEqual(@as(usize, 1), s.saved); } diff --git a/test/column_tags.py b/test/column_tags.py index ba638b7d..838dbd9a 100644 --- a/test/column_tags.py +++ b/test/column_tags.py @@ -114,9 +114,9 @@ def run(args): launch=launch, inherited=env, terminal=handles) as (client, address), contextlib.ExitStack() as connections: print('socket', address, flush=True) keys = Input(handles['input_fd']) - await_text(client, 1, 'New Tty Find Grep Joincol') - require(locate(client, 'New Tty', row=1) == (0, 1), 'left column tag does not start flush-left') - require(tag(client, 1).startswith(str(source) + ' Save Tty Del'), + await_text(client, 1, 'New Term Find Grep Joincol') + require(locate(client, 'New Term', row=1) == (0, 1), 'left column tag does not start flush-left') + require(tag(client, 1).startswith(str(source) + ' Save Term Del'), 'generated gap still separates the filename from pane commands') checks.append('pane commands follow the filename with one space') @@ -147,14 +147,14 @@ def run(args): right_body = b'// Column-local scratch\nfn main() {\n let ready = true;\n}\n' client.write(f'/pane/{right}/body', right_body) client.write(f'/pane/{right}/dirty', b'0\n') - require(wait_for(lambda: locate(client, 'New Tty', row=1, minimum_col=75)), 'right column tag missing') - require(locate(client, 'New Tty', row=1, minimum_col=75) == (75, 1), + require(wait_for(lambda: locate(client, 'New Term', row=1, minimum_col=75)), 'right column tag missing') + require(locate(client, 'New Term', row=1, minimum_col=75) == (75, 1), 'right column tag retains an inset') checks.append('column tags start at the first cell of each column') # Column header uses half-open drag ranges; replacement must not leak # into its neighbour, the global header, or the active pane's body. - col_start, _ = locate(client, 'New Tty', row=1, minimum_col=75) + col_start, _ = locate(client, 'New Term', row=1, minimum_col=75) keys.click(col_start, 1) keys.send(b'\x1b[F') keys.send(' Scope λ界') @@ -181,7 +181,7 @@ def run(args): # An owned short-path file makes its complete tag visible. Pane-tag # selections retain the existing inclusive endpoint convention. - save_x, pane_y = require(wait_for(lambda: locate(client, 'Save Tty', minimum_col=75)), 'right pane actions missing') + save_x, pane_y = require(wait_for(lambda: locate(client, 'Save Term', minimum_col=75)), 'right pane actions missing') keys.click(save_x, pane_y) keys.send(b'\x1b[F') keys.send(' TailMark') @@ -206,9 +206,9 @@ def run(args): # Keep a real embedded shell in the right column for useful captures. keys.click(12, 4) before = panes(client) - keys.click(*require(locate(client, 'Tty', row=1, minimum_col=75), 'Tty missing'), button=1) - terminal = require(wait_for(lambda: new_serial(client, before)), 'column Tty did not create a pane') - require('pty' in client.list(f'/pane/{terminal}'), 'Tty created a non-terminal pane') + keys.click(*require(locate(client, 'Term', row=1, minimum_col=75), 'Term missing'), button=1) + terminal = require(wait_for(lambda: new_serial(client, before)), 'column Term did not create a pane') + require('pty' in client.list(f'/pane/{terminal}'), 'Term created a non-terminal pane') client.write(f'/pane/{terminal}/pty/data', b"printf 'Column-local terminal ready\\n'; pwd\r") require(wait_for(lambda: b'\nColumn-local terminal ready\n' in client.read(f'/pane/{terminal}/body').replace(b'\r', b'')), 'terminal command output missing') checks.append('right-column embedded terminal executes harmless commands') @@ -222,7 +222,7 @@ def run(args): saved_global = re.search(rb'\.topbar_custom\s*=\s*"((?:[^"\\]|\\.)*)"', dumped) require(saved_global and codecs.escape_decode(saved_global[1])[0].decode() == global_text, 'global custom tag absent from dump') - require(b'New Tty Find Grep Joincol Work' in dumped, 'column custom tag absent from dump') + require(b'New Term Find Grep Joincol Work' in dumped, 'column custom tag absent from dump') keys.click(1, 0) keys.send(b'\x1b[F') keys.send(' TEMP') @@ -256,19 +256,19 @@ def run(args): keys.send(clean_global) require(wait_for(lambda: row_text(client, 0) == clean_global), 'clean global tag replacement failed') keys.escape() - col_start, _ = require(locate(client, 'New Tty', row=1, minimum_col=75), 'right column tag missing after restore') + col_start, _ = require(locate(client, 'New Term', row=1, minimum_col=75), 'right column tag missing after restore') keys.click(col_start, 1) keys.send(b'\x1b[H\x1b[1;2F') - keys.send('New Tty Find Grep Joincol Work') - require(wait_for(lambda: row_text(client, 1).endswith('New Tty Find Grep Joincol Work')), + keys.send('New Term Find Grep Joincol Work') + require(wait_for(lambda: row_text(client, 1).endswith('New Term Find Grep Joincol Work')), 'clean column tag replacement failed') keys.escape() - clean_pane = str(right_name) + ' Save Tty Del Collapse' + clean_pane = str(right_name) + ' Save Term Del Collapse' current_pane = tag(client, right) require(current_pane.startswith(clean_pane), 'unexpected scratch tag before presentation cleanup') suffix = current_pane[len(clean_pane):] require(suffix.isascii(), 'presentation cleanup expects its own ASCII test suffix') - keys.click(*require(locate(client, 'Save Tty', minimum_col=75), 'scratch pane commands missing')) + keys.click(*require(locate(client, 'Save Term', minimum_col=75), 'scratch pane commands missing')) keys.send(b'\x1b[F') keys.send(b'\x7f' * len(suffix)) require(wait_for(lambda: tag(client, right) == clean_pane), 'clean pane command tail replacement failed') @@ -282,7 +282,7 @@ def run(args): source_tag = tag(client, source_serial) keys.click(12, 2) keys.send(b'\x1b[F') - require(wait_for(lambda: (point := locate(client, 'Save Tty Del', row=2)) + require(wait_for(lambda: (point := locate(client, 'Save Term Del', row=2)) and point[0] < 75), 'long-path tag did not reveal its command tail at End') require(tag(client, source_serial) == source_tag, 'caret movement changed the source tag') capture(client, root, 'columns-tag-reveal', not args.tty) diff --git a/test/daemon.py b/test/daemon.py index 954433a9..7db7e055 100644 --- a/test/daemon.py +++ b/test/daemon.py @@ -449,7 +449,7 @@ def clients(binary): assert b'let this client go' in ta.text(), ta.text()[-300:] # A third client, a shell: its keys wait for the session (a pty # write), its output comes back in units, the same on both sides. - nine.write(f'/pane/{pane}/exec', b'Tty\n') + nine.write(f'/pane/{pane}/exec', b'Term\n') shell = wait_for('a shell pane', lambda: next((int(row.split()[0]) for row in nine.read('/index').splitlines() if row.split()[1] == b'term'), None)) wait_for('the shell\'s prompt', lambda: b'$' in nine.read(f'/pane/{shell}/body') or b'#' in nine.read(f'/pane/{shell}/body')) @@ -522,7 +522,7 @@ def manage(binary): status = dict(line.split(maxsplit=1) for line in c.read('/status').decode().splitlines()) sessions[name] = int(status['pid']) started.append(sessions[name]) - c.write('/pane/1/exec', b'Tty\n') + c.write('/pane/1/exec', b'Term\n') wait_for(f'session {name}\'s shell', lambda: terminals(c)) shell = terminals(c)[0] wait_for(f'session {name}\'s shell answers', lambda: run(c, shell, b'true\n') == b'exit 0\n') @@ -1078,7 +1078,7 @@ def main(binary, cycles): started = [] try: term = Term() - stub = term.spawn([binary, '--tty', '--9p=work'], env) + stub = term.spawn([binary, '--tui', '--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, '--tty', '--9p=fresh'], env) + str(stub_pid), binary, '--tui', '--9p=fresh'], env) started.append(shell.pid) sock = root / 'pardes-9p-fresh.sock' wait_for('the second session', sock.exists) @@ -1403,7 +1403,7 @@ def install(binary, at): def upgrades(old, new): - """Upgrade (docs/next-daemon.md, phase 6): a tty session with an unsaved + """Upgrade (docs/next-daemon.md, phase 6): a tui session with an unsaved edit, a shell running `sleep 1000; echo done` and two terminals (two views) moved onto another build installed at the path it started from, the daemon with it; then a build that refuses the dump, which falls back @@ -1425,7 +1425,7 @@ def upgrades(old, new): started = [] try: term = Term() - stub = term.spawn([str(binary), '--tty', '--9p=work'], env) + stub = term.spawn([str(binary), '--tui', '--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), '--tty', '--9p=again'], env) + stub = term.spawn([str(binary), '--tui', '--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 6011ba16..6d0a43ca 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. "--tty"). + /// Like init, but passes one extra CLI arg to the app (e.g. "--tui"). 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; @@ -221,7 +221,7 @@ pub const Harness = struct { /// The app's output into the emulator. The one query answered is the /// device status request (`CSI 5 n` → `CSI 0 n`), as every terminal /// does: the tty asks it after each frame and draws no other until the - /// answer (FrameAck in src/tty/tty.zig). + /// answer (FrameAck in src/tui/tui.zig). fn feed(self: *Harness, bytes: []const u8) void { self.stream.nextSlice(bytes); const request = "\x1b[5n"; @@ -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, '--tty', '--9p=' + (socket_name or name), *options, str(file or fixture)] + args = [binary, '--tui', '--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/gui_golden.py b/test/gui_golden.py index 24fc5986..9afc9c19 100644 --- a/test/gui_golden.py +++ b/test/gui_golden.py @@ -208,8 +208,8 @@ def run(args): client.write('/ctl', b'Debug\n') # A terminal pane: raw rows, ANSI colours, a hidden prompt. before = set(panes(client)) - client.write(f'/pane/{first}/exec', b'Tty\n') - terminal = require(wait_for(lambda: next((s for s in panes(client) if s not in before), None)), 'Tty missing') + client.write(f'/pane/{first}/exec', b'Term\n') + terminal = require(wait_for(lambda: next((s for s in panes(client) if s not in before), None)), 'Term missing') client.write(f'/pane/{terminal}/pty/data', b"PS1='$ '; clear; printf '\\033[1;36mcolour\\033[0m plain \\033[32mgreen\\033[0m\\n'\r") require(wait_for(lambda: b'green' in client.read(f'/pane/{terminal}/body')), 'terminal output missing') scene('17-terminal') diff --git a/test/image_harness.zig b/test/image_harness.zig index b45851cc..18392851 100644 --- a/test/image_harness.zig +++ b/test/image_harness.zig @@ -58,7 +58,7 @@ pub fn main(init: std.process.Init) !void { _ = setenv("TERM", "xterm-256color", 1); _ = setenv("LC_ALL", "C", 1); - if (std.mem.eql(u8, backend, "tty")) { + if (std.mem.eql(u8, backend, "tui")) { if (pdf_mode) try runKittyPdf(arena, exe, base) else diff --git a/test/kitty.zig b/test/kitty.zig index 1e1e8331..f5de44e7 100644 --- a/test/kitty.zig +++ b/test/kitty.zig @@ -1,6 +1,6 @@ //! Kitty graphics protocol conformance for terminal panes, at the core. //! -//! zig build kitty-test -Dplatform=tty|gui these cases alone +//! zig build kitty-test -Dplatform=tui|gui these cases alone //! zig build unit-test they run with the rest //! //! ghostty-vt implements the protocol; what pardes owns is the proxy around diff --git a/test/kitty_harness.zig b/test/kitty_harness.zig index 652395b8..204dae69 100644 --- a/test/kitty_harness.zig +++ b/test/kitty_harness.zig @@ -1,6 +1,6 @@ //! Kitty graphics end to end through a terminal pane. //! -//! zig build kitty-harness -Dplatform=tty a fake kitty terminal outside +//! zig build kitty-harness -Dplatform=tui a fake kitty terminal outside //! zig build kitty-harness -Dplatform=gui the SDL renderer's capture //! //! test/kitty.zig checks the proxy at the core; this checks it through the @@ -67,7 +67,7 @@ pub fn main(init: std.process.Init) !void { try run.start(); if (std.c.getenv("PARDES_KITTY_EXPLORE")) |list| return run.explore(std.mem.span(list)); - std.debug.print("kitty harness ({s}):\n", .{if (gui) "gui" else "tty"}); + std.debug.print("kitty harness ({s}):\n", .{if (gui) "gui" else "tui"}); try run.query(); try run.place(); try run.media(); diff --git a/test/monkey.zig b/test/monkey.zig index 2e19cb21..70a4b4e4 100644 --- a/test/monkey.zig +++ b/test/monkey.zig @@ -1,6 +1,6 @@ // pardes-monkey: random snapshot scripts against the tty, hunting panics. // -// zig build monkey -Dplatform=tty -- <seeds> [steps] [--from=N] [--out=DIR] [--keep] [--views=N] +// zig build monkey -Dplatform=tui -- <seeds> [steps] [--from=N] [--out=DIR] [--keep] [--views=N] // // Each seed makes one script (a fixed seed makes the same script, so a hit // replays): keys and leader bursts, typing, mouse presses, drags and wheel, diff --git a/test/monkey9p.zig b/test/monkey9p.zig index 45c5d12f..8870e389 100644 --- a/test/monkey9p.zig +++ b/test/monkey9p.zig @@ -4,8 +4,8 @@ //! /log said meanwhile. It was test/monkey9p.py, which drove a real //! `pardes --detach` over its socket. //! -//! zig build monkey-session -Dplatform=tty -- [--seed N]... [--steps M] [--only i,j,k] [--no-shrink] [-v] -//! zig build monkey-session-smoke -Dplatform=tty (part of behaviour-test) +//! zig build monkey-session -Dplatform=tui -- [--seed N]... [--steps M] [--only i,j,k] [--no-shrink] [-v] +//! zig build monkey-session-smoke -Dplatform=tui (part of behaviour-test) //! //! A step's op is drawn from the seed alone: the panes, columns and held //! files it names are tokens (`{p3}`: /index's 4th serial, mod its length, @@ -72,7 +72,7 @@ const shell_lines = [_][]const u8{ "true", "false", "echo hi", "echo m9p", "slee const builtins = [_][]const u8{ "Look", "Exec", "Kill", "Dump", "Msg", "NextColor", "Themes", "DumpThemes", "TreeContext", "PdfFit", "PdfTint", "PdfSections", "Petscii", "Palette", "Ascii", "Save", "New", "Newcol", "Del", "Filter", "Mode", "Togglettymode", "Edit", "Undo", "Redo", "Collapse", - "Delcol", "DelAbove", "DelBelow", "Tty", "Repl", "Joincol", "Config", "LocationsConfig", "Messages", "Mini", "Find", "Grep", "Left", + "Delcol", "DelAbove", "DelBelow", "Term", "Repl", "Joincol", "Config", "LocationsConfig", "Messages", "Mini", "Find", "Grep", "Left", "Down", "Up", "Right", "Back", "Forward", "Last", "Recent", "Jumplist", "Colors", "Wrap", "Tagbottom", "Debug", "FocusTint", "Verbose", "Motion", "InactiveDim", "DumpDir", "Theme", "Placement", "BootShell", "LookWord", "Get", "Put", "Undo", "Redo", "Zerox", "Snarf", "Paste", "Cut", "Sort", "Font", "Local", @@ -426,7 +426,7 @@ fn gen(r: Random, a: Allocator) Op { const s = pickSerial(r, a); const line = shellSafe(a, pick(r, &shell_lines)); const x = chance(r); - if (x < 0.25) return .{ .write = .{ .path = print(a, "/pane/{s}/ctl", .{s}), .data = "Tty\n" } }; + if (x < 0.25) return .{ .write = .{ .path = print(a, "/pane/{s}/ctl", .{s}), .data = "Term\n" } }; if (x < 0.45) return .{ .write = .{ .path = print(a, "/pane/{s}/pty/run", .{s}), .data = cat(a, &.{ line, "\n" }), .mode = ORDWR } }; if (x < 0.6) return .{ .write = .{ .path = print(a, "/pane/{s}/pty/data", .{s}), .data = cat(a, &.{ line, "\r" }) } }; if (x < 0.75) return .{ .write = .{ .path = print(a, "/pane/{s}/pty/ctl", .{s}), .data = pick(r, &[_][]const u8{ "sig INT\n", "sig TERM\n", "sig KILL\n", "sig HUP\n" }) } }; @@ -1603,7 +1603,7 @@ fn shrink(gpa: Allocator, seed: u64, f: Found, budget: usize) !void { const small = try ddmin(gpa, body, &trial, Trial.fails); var text: std.ArrayList(u8) = .empty; for (small, 0..) |n, i| try text.print(gpa, "{s}{d}", .{ if (i > 0) "," else "", n }); - std.debug.print(" shrunk {d} -> {d} ops: zig build monkey-session -Dplatform=tty -- --seed {d} --steps {d} --only {s} -v\n", .{ body.len, small.len, seed, f.step + 1, text.items }); + std.debug.print(" shrunk {d} -> {d} ops: zig build monkey-session -Dplatform=tui -- --seed {d} --steps {d} --only {s} -v\n", .{ body.len, small.len, seed, f.step + 1, text.items }); } fn usage() noreturn { diff --git a/test/output.zig b/test/output.zig index 876cd8fc..f484c3e6 100644 --- a/test/output.zig +++ b/test/output.zig @@ -578,7 +578,7 @@ test "EffectCode lists readable virtual sources used by this backend" { try std.testing.expect(out.content.len < 1024); try std.testing.expect(std.mem.indexOf(u8, out.content, "/virtual/src/layout.zig\n") != null); const backend_source = switch (platform) { - .tty => "/virtual/src/tty/panel_compositor.zig", + .tui => "/virtual/src/tui/panel_compositor.zig", .gui => "/virtual/shaders/ui.vert.glsl", .macos => "/virtual/src/macos/Sources/ScenePostprocessor.swift", .web, .esp32p4 => unreachable, diff --git a/test/pdf_scroll_bench.zig b/test/pdf_scroll_bench.zig index 0f93068d..f3d47b1e 100644 --- a/test/pdf_scroll_bench.zig +++ b/test/pdf_scroll_bench.zig @@ -21,7 +21,7 @@ //! the single render — not on one notch. Every timed region below is exactly //! that: `ticks_per_frame` real `Mouse.wheel_down`/`wheel_up` presses through //! `Pardes.update`, one `render()` into a reset frame arena, and the effect -//! drain, which is the loop src/tty/tty.zig and src/gui/gui.zig both run. +//! drain, which is the loop src/tui/tui.zig and src/gui/gui.zig both run. //! //! Rows are per-FRAME latency, not per-notch: a dropped frame is what a reader //! feels, and the batch is indivisible from the reader's point of view. @@ -60,7 +60,7 @@ const gpa = std.heap.smp_allocator; // A reading-sized window. Wide enough that fit-width pages are taller than the // viewport (so a fling genuinely crosses page boundaries) and small enough // that the Kitty raster policy's 1200px cap is the binding quality term, which -// is what the tty shell actually ships. +// is what the tui shell actually ships. const bench_cols: u16 = 120; const bench_rows: u16 = 40; const default_cell_pixels: pardes.CellPixels = .{ .w = 8, .h = 16 }; @@ -383,7 +383,7 @@ fn measure(config: Config, plan: Plan) !Result { total += elapsed; recorder.observe(frame, surface); peak_raster_bytes = @max(peak_raster_bytes, rasterBytes(pv)); - // The same frame boundary src/tty/tty.zig marks, so a Tracy capture + // The same frame boundary src/tui/tui.zig marks, so a Tracy capture // of this benchmark reads like a capture of the real shell. pardes.frameMark(); if (round >= config.warmup) { diff --git a/test/perf.zig b/test/perf.zig index 31a48cc7..31a813cb 100644 --- a/test/perf.zig +++ b/test/perf.zig @@ -1319,7 +1319,7 @@ fn liveYes(l: *Live, exe: [:0]const u8) !void { var h = try eh.Harness.initArgv(gpa, exe, screen_rows, screen_cols, &.{ "-n", "1" }); errdefer h.dump("live yes"); // The prompt shows in tty mode only: the shell's tag, then Ctrl-b in. - if (!try h.waitFor("Tty+bash", 20_000)) return error.LiveNoPrompt; + if (!try h.waitFor("Term+bash", 20_000)) return error.LiveNoPrompt; try h.pump(500); try h.send("\x02"); if (!try h.waitFor("$ ", 20_000)) return error.LiveNoPrompt; @@ -1387,7 +1387,7 @@ fn measureLive(io: std.Io, exe: []const u8, gui: bool, reps: usize, json: bool) try liveOpen(&l, exe_z); liveSweep(io); } - const frontend = if (gui) "gui" else "tty"; + const frontend = if (gui) "gui" else "tui"; const out = std.Io.File.stdout(); var buf: [256]u8 = undefined; for (live_phases, &l.samples, &l.core) |name, *samples, *core| { diff --git a/test/process.zig b/test/process.zig index 21bc8e31..94dfd313 100644 --- a/test/process.zig +++ b/test/process.zig @@ -507,13 +507,13 @@ pub fn of(gpa: std.mem.Allocator, h: *const eh.Harness) Files { /// of the user's is reached. No daemon (PARDES_DAEMON=off, as the pty /// harness starts one): the process is the session, and nothing outlives it. /// Which build the process tests drive (`zig build process-test -/// -Dplatform=tty|gui`, the runner's --backend): a session's effects +/// -Dplatform=tui|gui`, the runner's --backend): a session's effects /// (saves, shells, watches, dumps) are its host's, so each case runs on the /// host it was built with. -pub const Backend = enum { tty, gui }; -pub var backend: Backend = .tty; +pub const Backend = enum { tui, gui }; +pub var backend: Backend = .tui; -/// A case about one frontend's own behaviour (`--tty`, a killed terminal +/// A case about one frontend's own behaviour (`--tui`, a killed terminal /// editor) skips on the other. pub fn only(b: Backend) !void { if (backend != b) return error.SkipZigTest; @@ -725,15 +725,15 @@ pub const Detached = struct { return std.fmt.allocPrintSentinel(d.files.arena.allocator(), "{s}/{s}", .{ d.root(), rel }, 0) catch @panic("out of memory"); } - /// Another session in this root, in a pty, as fs.py's tty sessions: - /// `pardes --tty --9p=<name> <args> <root>/<name>.txt` (holding + /// Another session in this root, in a pty, as fs.py's tui sessions: + /// `pardes --tui --9p=<name> <args> <root>/<name>.txt` (holding /// "initial\n"), back once its socket (`abs("pardes-9p-<name>.sock")`) /// is there. - pub fn startTty(d: *Detached, exe: [:0]const u8, name: []const u8, args: []const [:0]const u8) !Child { + pub fn startTui(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, "--tty", try std.fmt.allocPrintSentinel(a, "--9p={s}", .{name}, 0) }); + try argv.appendSlice(a, &.{ exe, "--tui", 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 410a3f54..0d8ef5d4 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 }) |tty| { + for ([_]bool{ false, true }) |tui| { var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); const a = arena.allocator(); - const name = if (tty) "lsp-tty" else "lsp-detached"; - var d = try process.Detached.start(gpa, exe, if (tty) "lsp-root" else name, .{}); + const name = if (tui) "lsp-tui" else "lsp-detached"; + var d = try process.Detached.start(gpa, exe, if (tui) "lsp-root" else name, .{}); defer d.deinit(); var term: ?process.Child = null; defer if (term) |*t| t.deinit(); - if (tty) term = try d.startTty(exe, name, &.{}); + if (tui) term = try d.startTui(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 aa5b7497..78be22f6 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, "--tty", row[0] }, opts); + const r = try process.run(a, &.{ exe, "--tui", 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,14 +213,16 @@ 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", &.{ "--tty", z(a, "--mount=peer={s}", .{address}), "/n/peer/pane/1/body" }, null }, - .{ "name", &.{ "--tty", "--9p=forwarded-name" }, "forwarded-name" }, - .{ "tcp", &.{ "--tty", "--9p-tcp=tcp!127.0.0.1!0" }, null }, - .{ "load", &.{ "--tty", "-l", saved }, null }, + .{ "mount", &.{ "--tui", z(a, "--mount=peer={s}", .{address}), "/n/peer/pane/1/body" }, null }, + .{ "name", &.{ "--tui", "--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 }, .{ "shells", &.{ "-n", "3" }, 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 }, + .{ "toggle", &.{ "--tui", "--tty-toggle=q" }, null }, + .{ "toggle-arg", &.{ "--tui", "--tty-toggle", "q" }, null }, + .{ "quic", &.{ "--tui", "--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; @@ -258,7 +260,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, "--tty", spaced }, .{ .root = d.root(), .env = &.{ inherited[0], .{ "PARDES_PANE", "4294967295" }, inherited[2] } }); + const gone = try process.run(a, &.{ exe, "--tui", 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"); @@ -272,7 +274,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, "--tty", undefined }; + var argv: [3][:0]const u8 = .{ exe, "--tui", 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(); @@ -653,7 +655,7 @@ fn commandBody(a: std.mem.Allocator, c: *Conn, node: []const u8) ![]const u8 { fn outside(gpa: std.mem.Allocator, exe: [:0]const u8) !void { // The terminal frontend's and a detached session's own: a window is neither. - try process.only(.tty); + try process.only(.tui); var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); const a = arena.allocator(); @@ -678,7 +680,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, "--tty", "x.txt" }, .{ .root = d.root(), .pty = .{ .log = d.abs("noctty.pty"), .ctty = false } }); + var tty = try Child.spawn(&.{ exe, "--tui", "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); @@ -699,7 +701,7 @@ fn socketFile(path: []const u8) !void { fn killedTty(gpa: std.mem.Allocator, exe: [:0]const u8) !void { // The terminal frontend's and a detached session's own: a window is neither. - try process.only(.tty); + try process.only(.tui); var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); const a = arena.allocator(); @@ -718,7 +720,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, "--tty", "x.txt" }, .{ .root = d.root(), .env = &.{.{ "PARDES_DAEMON", "on" }}, .pty = .{ .log = log } }); + var killed = try Child.spawn(&.{ exe, "--tui", "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")) { @@ -763,7 +765,7 @@ fn daemonGone(d: *const process.Detached) void { fn signalCleansUp(gpa: std.mem.Allocator, exe: [:0]const u8) !void { // The terminal frontend's and a detached session's own: a window is neither. - try process.only(.tty); + try process.only(.tui); // A detached session told to stop by a signal unlinks its sockets. A // hangup is a terminal's end, not a session's: the daemon keeps it. for ([_]libc.SIG{ .TERM, .INT, .HUP }) |first| { diff --git a/test/process/look_and_exec.zig b/test/process/look_and_exec.zig index 8ff01054..83836def 100644 --- a/test/process/look_and_exec.zig +++ b/test/process/look_and_exec.zig @@ -64,9 +64,9 @@ const Flow = struct { fn canary(gpa: std.mem.Allocator, exe: [:0]const u8) !void { // shortcut: on the window, after its terminal steps, Newcol is refused - // (or a run hangs), where a fresh window takes it; tty alone until that + // (or a run hangs), where a fresh window takes it; tui alone until that // is found (docs/next-tests.md). - try process.only(.tty); + try process.only(.tui); const started = process.nowMs(); var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); @@ -121,7 +121,7 @@ fn canary(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try std.testing.expectEqualStrings("from disk\n", try c.pane(a, pb, "body")); // A terminal: pty/run failing then passing. - const term = try f.madeBy(1, "Tty\n"); + const term = try f.madeBy(1, "Term\n"); { const deadline = process.nowMs() + 10_000; while (true) { diff --git a/test/process/mounts.zig b/test/process/mounts.zig index 10dc7b5a..f59a7a0f 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 }) |tty| for ([_][:0]const u8{ "127.0.0.1", "::1" }) |host| { + for ([_]bool{ false, true }) |tui| 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 (tty) "quic-root" else "server", .{ .args = if (tty) &.{} else &args }); + var d = try Detached.start(gpa, exe, if (tui) "quic-root" else "server", .{ .args = if (tui) &.{} else &args }); defer d.deinit(); var term: ?process.Child = null; defer if (term) |*t| t.deinit(); - if (tty) term = try d.startTty(exe, "server", &args); + if (tui) term = try d.startTui(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/repls.zig b/test/process/repls.zig index 09e25e96..a6fe07ac 100644 --- a/test/process/repls.zig +++ b/test/process/repls.zig @@ -35,7 +35,7 @@ fn pythonRepl(gpa: std.mem.Allocator, exe: [:0]const u8) !void { const c = try Conn.dial(gpa, d.socket()); defer c.deinit(gpa); const before = try c.serials(a); - try c.write("/pane/1/ctl", "Tty\n"); + try c.write("/pane/1/ctl", "Term\n"); const deadline = process.nowMs() + 10_000; var tty: u32 = 0; while (tty == 0 and process.nowMs() < deadline) : (process.nap(50)) { @@ -43,7 +43,7 @@ fn pythonRepl(gpa: std.mem.Allocator, exe: [:0]const u8) !void { tty = @max(tty, n); }; } - try check(tty != 0, "Tty made no pane", .{}); + try check(tty != 0, "Term made no pane", .{}); try check(try waitFor(a, c, tty, "$", 15_000) or try waitFor(a, c, tty, ">", 15_000), "no prompt: {s}", .{try c.pane(a, tty, "body")}); try c.write(try std.fmt.allocPrint(a, "/pane/{d}/pty/data", .{tty}), "python3 -q\r"); try check(try waitFor(a, c, tty, ">>>", 15_000), "no >>>: {s}", .{try c.pane(a, tty, "body")}); diff --git a/test/process/root_ctl.zig b/test/process/root_ctl.zig index 8ad92f7d..f4a0149b 100644 --- a/test/process/root_ctl.zig +++ b/test/process/root_ctl.zig @@ -28,7 +28,7 @@ fn exitAnswers(gpa: std.mem.Allocator, exe: [:0]const u8) !void { /// Nothing attached, no key, no click, no other request comes to move it along. fn messagesExpire(gpa: std.mem.Allocator, exe: [:0]const u8) !void { // With nothing attached: a window always is. - try process.only(.tty); + try process.only(.tui); var d = try process.Detached.start(gpa, exe, "msg", .{}); defer d.deinit(); try d.files.write("/pane/1/ctl", "Msg lingering-words\n"); @@ -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 }) |tty| { + for ([_]bool{ false, true }) |tui| { var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); const a = arena.allocator(); - 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, .{}); + 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, .{}); defer d.deinit(); var term: ?process.Child = null; defer if (term) |*t| t.deinit(); - if (tty) term = try d.startTty(exe, name, &.{}); + if (tui) term = try d.startTui(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 == .tty) try std.testing.expectEqual(@as(usize, if (tty) 80 else 160), width); + if (process.backend == .tui) try std.testing.expectEqual(@as(usize, if (tui) 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/process/terminals.zig b/test/process/terminals.zig index e7e93a4f..96804adf 100644 --- a/test/process/terminals.zig +++ b/test/process/terminals.zig @@ -79,9 +79,9 @@ const Other = struct { }; fn runFile(gpa: std.mem.Allocator, exe: [:0]const u8) !void { - // shortcut: on the window a fresh Tty's first pty/run sometimes never - // answers (4 runs of 6); tty alone until that is found (docs/next-tests.md). - try process.only(.tty); + // shortcut: on the window a fresh Term's first pty/run sometimes never + // answers (4 runs of 6); tui alone until that is found (docs/next-tests.md). + try process.only(.tui); var d = try process.Detached.start(gpa, exe, "run", .{}); defer d.deinit(); const f = &d.files; @@ -97,12 +97,12 @@ fn runFile(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try c.write(f.at("/pane/{d}/name", .{peer}), "/n/nosuchpeer/d/f.txt\n"); const count = std.mem.count(u8, try c.read(a, "/index"), "\n"); try refusedSaying(c, f.at("/pane/{d}/exec", .{peer}), "ls\n", "no such directory"); - try refusedSaying(c, f.at("/pane/{d}/exec", .{peer}), "Tty\n", "no such directory"); + try refusedSaying(c, f.at("/pane/{d}/exec", .{peer}), "Term\n", "no such directory"); try expectEqual(count, std.mem.count(u8, try c.read(a, "/index"), "\n")); try expect(!has(try c.read(a, "/log"), "exit 127")); try c.remove(f.at("/pane/{d}", .{peer})); try c.write("/exec", "Shell bash\n"); - try c.write("/exec", "Tty\n"); + try c.write("/exec", "Term\n"); var term: u32 = 0; var rows = std.mem.tokenizeScalar(u8, try c.read(a, "/index"), '\n'); while (rows.next()) |r| { @@ -222,8 +222,8 @@ fn namedOnce(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var made: std.ArrayList(u32) = .empty; try made.append(a, try c.look(a, f.at("{s}/sub", .{root}), null)); const before = try serials(a, c); - try c.write("/pane/1/ctl", "Tty\n"); - if (shell(a, "command -v fish >/dev/null", .{}) == 0) try c.write("/pane/1/ctl", "Tty fish\n"); + try c.write("/pane/1/ctl", "Term\n"); + if (shell(a, "command -v fish >/dev/null", .{}) == 0) try c.write("/pane/1/ctl", "Term fish\n"); for (try serials(a, c)) |s| if (std.mem.indexOfScalar(u32, before, s) == null) try made.append(a, s); try expect(made.items.len >= 2); process.sleep(1500); // their shells start and say where they are @@ -235,14 +235,14 @@ fn namedOnce(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try expect(!has(log, f.at("\nrename {d} ", .{s}))); try expect(has(log, f.at("\nnew {d} {s}", .{ s, root }))); } - // A shell that cannot start (its interpreter is not there): Tty fails + // A shell that cannot start (its interpreter is not there): Term fails // the write with why and leaves no pane; pty/ctl exec fails with why // and keeps its terminal. try d.put("badsh", "#!/nonexistent/interp\n"); const bad = f.at("{s}/badsh", .{root}); _ = libc.chmod(try std.fmt.allocPrintSentinel(a, "{s}", .{bad}, 0), 0o755); const panes = std.mem.count(u8, try c.read(a, "/index"), "\n"); - try refusedSaying(c, "/pane/1/ctl", f.at("Tty {s}\n", .{bad}), "interpreter /nonexistent/interp not found"); + try refusedSaying(c, "/pane/1/ctl", f.at("Term {s}\n", .{bad}), "interpreter /nonexistent/interp not found"); try refusedSaying(c, "/ctl", f.at("Shell {s}\n", .{bad}), "interpreter /nonexistent/interp not found"); process.sleep(300); try expectEqual(panes, std.mem.count(u8, try c.read(a, "/index"), "\n")); @@ -275,7 +275,7 @@ fn drive(gpa: std.mem.Allocator, exe: [:0]const u8, script: []const u8, key: ?u8 const f = &d.files; try d.put("command.sh", f.at("exec /bin/sh -c '{s}'\n", .{script})); try f.write("/ctl", "Shell /bin/sh\n"); - try f.write("/exec", "Tty\n"); + try f.write("/exec", "Term\n"); const term = try f.focused(); const body = f.at("/pane/{d}/body", .{term}); const data = f.at("/pane/{d}/pty/data", .{term}); diff --git a/test/process/tree.zig b/test/process/tree.zig index ee39170b..27b51bf1 100644 --- a/test/process/tree.zig +++ b/test/process/tree.zig @@ -482,7 +482,7 @@ fn cutWrites(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try expectEqual(@as(usize, 2500), k); // A detached session with no frontend is 160x50 until told; a // window's size is its own, and refuses size. - if (process.backend == .tty) { + if (process.backend == .tui) { const cols, const rows = try screenSize(f); try expect(cols == 160 and rows == 50); try c.write("/ctl", "size 132 40\n"); diff --git a/test/process_test.zig b/test/process_test.zig index a870f13a..67f28f53 100644 --- a/test/process_test.zig +++ b/test/process_test.zig @@ -21,7 +21,7 @@ const files = .{ pub fn main(init: std.process.Init) !void { const all = try init.minimal.args.toSlice(init.arena.allocator()); - // <pardes> [--backend=tty|gui] [filter] + // <pardes> [--backend=tui|gui] [filter] var args: [3][:0]const u8 = undefined; var n: usize = 0; for (all[1..]) |a| { diff --git a/test/record_casts.py b/test/record_casts.py index 13893517..15f46ced 100644 --- a/test/record_casts.py +++ b/test/record_casts.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """Record the documentation site's terminal casts (asciicast v2). -zig build -Dplatform=tty -Doptimize=ReleaseSafe --prefix <scratch dir> +zig build -Dplatform=tui -Doptimize=ReleaseSafe --prefix <scratch dir> python3 -B test/record_casts.py <scratch dir>/bin/pardes [cast ...] [--show] Each cast runs the tty pardes in a pty this script owns, sized 100x30 with @@ -770,8 +770,8 @@ def terminals(r): """A shell beside the notes: run, Ctrl-b, copy a line of output into the file; then git log paged through pardes - into a +Pager.""" r.step(None, until=lambda s: 'What ./hello prints' in s.text(), quiet=.4, hold=1.2) - start, end = word_at(r, 'Tty', 2) - r.sweep(1, start, end, show=.5, hold=.6, until=lambda s: 'Tty+sh' in s.text(), what='the shell') + start, end = word_at(r, 'Term', 2) + r.sweep(1, start, end, show=.5, hold=.6, until=lambda s: 'Term+sh' in s.text(), what='the shell') r.step(None, until=lambda s: s.text().count('$') >= 2, hold=.4) # Its own column, beside the file: Ctrl-b to normal, Alt-c, Ctrl-b back. r.step('\x02', hold=.3) @@ -909,7 +909,7 @@ def show(name, work, at=None): def main(): parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) - parser.add_argument('binary', type=Path, nargs='?', help='a pardes built with -Dplatform=tty') + parser.add_argument('binary', type=Path, nargs='?', help='a pardes built with -Dplatform=tui') parser.add_argument('casts', nargs='*', help='which casts (default: all): ' + ', '.join(CASTS)) parser.add_argument('--work', type=Path, default=REPO.parent / '.scratch/casts/work', help='the session home, step logs and check pictures (default %(default)s)') diff --git a/test/record_demos.py b/test/record_demos.py index a2e48d73..4468ffb6 100644 --- a/test/record_demos.py +++ b/test/record_demos.py @@ -220,7 +220,7 @@ class Session: def terminal_rows(self): """The screen's rows below the (one) terminal's tag.""" rows = self.screen() - return rows[next(i for i, line in enumerate(rows) if 'Tty+sh' in line) + 1:] + return rows[next(i for i, line in enumerate(rows) if 'Term+sh' in line) + 1:] def wait(self, predicate, what, seconds=20): deadline = time.monotonic() + seconds @@ -594,7 +594,7 @@ def text_is_the_interface(s): def shell_setup(s): """A terminal under the file, at the project, with a short prompt.""" - s.write('/pane/1/exec', 'Tty\n') + s.write('/pane/1/exec', 'Term\n') s.wait(lambda: 2 in s.panes(), 'the terminal') s.write('/pane/2/pty/data', f"cd {PROJECT}; PS1='$ '; clear\r") s.wait(lambda: any(line.rstrip() == ' $' for line in s.screen()), 'the prompt') @@ -844,7 +844,7 @@ def theme_scene(s): subprocess.run(['git', '-C', str(PROJECT), *args], check=True, env=env, capture_output=True) main = PROJECT / 'src/main.c' main.write_text(main.read_text().replace('i <= 4', 'i <= 5')) - s.write('/pane/1/exec', 'Tty\n') + s.write('/pane/1/exec', 'Term\n') s.wait(lambda: 2 in s.panes(), 'the terminal') s.write('/pane/2/pty/data', f"cd {PROJECT}; PS1='$ '; clear; make; git diff\r") s.wait(lambda: len(s.panes()) == 3, 'the pager') diff --git a/test/replicas.zig b/test/replicas.zig index 18060763..4fcb9920 100644 --- a/test/replicas.zig +++ b/test/replicas.zig @@ -12,8 +12,8 @@ //! the authority steps, each replica acknowledging them over its link and //! asking for the rows it scrolls back into and does not hold. //! -//! zig build replicas -Dplatform=tty -- [--seeds N] [--steps M] [--clients C] [--rtt 30,80,207] [--first K] [--flood MB] [--shared] -//! zig build replicas -Dplatform=tty -- --echo [--seeds N] [--rtt 30,80,207] [--first K] +//! zig build replicas -Dplatform=tui -- [--seeds N] [--steps M] [--clients C] [--rtt 30,80,207] [--first K] [--flood MB] [--shared] +//! zig build replicas -Dplatform=tui -- --echo [--seeds N] [--rtt 30,80,207] [--first K] //! //! `--echo` types a corpus into a shell instead, with and without the //! predicted echo (src/echo.zig), and gates what it draws: below, at diff --git a/test/rollback_bench.zig b/test/rollback_bench.zig index 0f0c77a4..659a73d3 100644 --- a/test/rollback_bench.zig +++ b/test/rollback_bench.zig @@ -9,7 +9,7 @@ //! Then a fork of the big one, child gone at once, and the authority's //! copy-on-write after it. //! -//! zig build rollback-bench -Dplatform=tty -Doptimize=ReleaseFast +//! zig build rollback-bench -Dplatform=tui -Doptimize=ReleaseFast const std = @import("std"); const libc = std.c; const pardes = @import("pardes"); diff --git a/test/selfmount.py b/test/selfmount.py index 61d32523..1df17226 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, '--tty', '--9p=' + second, str(fixture)], env) + os.execve(ns, ['9ns', '--unix', served, '--', binary, '--tui', '--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, '--tty', '--9p=' + name, str(fixture)], env) + os.execve(ns, ['9ns', '--mntgen', '--', binary, '--tui', '--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, '--tty', '--9p=' + other], other_env) + os.execve(binary, [binary, '--tui', '--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/snapshot.zig b/test/snapshot.zig index 95d07cc7..00585018 100644 --- a/test/snapshot.zig +++ b/test/snapshot.zig @@ -1132,7 +1132,7 @@ fn readProc(buf: []u8, path: [*:0]const u8) ?[]const u8 { /// What a capture is made of: grid text, cursor cell, and a compact digest of /// every cell style. Style used not to matter to `stable`, which let a -/// color-only animation look idle while the TTY frontend was deliberately +/// color-only animation look idle while the TUI frontend was deliberately /// asleep between frames; a following `snapstyle` then caught a midpoint. fn stateKey(h: *eh.Harness) ![]u8 { const text = try h.screenText(); @@ -1455,7 +1455,7 @@ fn styleRows(arena: std.mem.Allocator, h: *eh.Harness) ![]const []const u8 { var run_len: usize = 0; var run_start: u16 = 0; // A blank's ink shows nowhere, and the tty leaves whatever ink the - // terminal had there (tty.zig blankInk), so it depends on the frames + // terminal had there (tui.zig blankInk), so it depends on the frames // before: a blank is written with the ink of the cell before it. var ink_buf: [16]u8 = undefined; var ink: []const u8 = "d"; diff --git a/test/snapshots/images.snap b/test/snapshots/images.snap index caed1fa1..d5dc580d 100644 --- a/test/snapshots/images.snap +++ b/test/snapshots/images.snap @@ -1,6 +1,6 @@ # image panes: right-click a .ppm opens petscii glyph art (no kitty in the # harness). The tag starts with the renderer's plain state fields followed by -# its path and `Tty Del`; the fields are display-only, while their toggles are +# its path and `Term Del`; the fields are display-only, while their toggles are # builtins under SPC t (the old clickable tag words sat past the pane's right # edge, so clicking them only ever hit the neighbouring shell's tag). ppmdiag pic.ppm @@ -41,12 +41,12 @@ snap no-ascii # prefix is wider than this source-local column, so widen the grid for this # final assertion. (A column-border drag intentionally takes width from only # one neighbour, which cannot expose this 82-column prefix.) Then click the -# visible tail itself, at its `Tty`. This proves the image tag is an ordinary +# visible tail itself, at its `Term`. This proves the image tag is an ordinary # editor rather than accidentally typing at a clipped read-only path. resize 31 400 stable 400 5000 -press left @Tty 7 -release left @Tty 7 +press left @Term 7 +release left @Term 7 stable 400 5000 key i send Zork\x20 diff --git a/test/snapshots/look-fd-deep.snap b/test/snapshots/look-fd-deep.snap index 8df0aaaf..d9e5ac06 100644 --- a/test/snapshots/look-fd-deep.snap +++ b/test/snapshots/look-fd-deep.snap @@ -18,7 +18,7 @@ stable 700 20000 text cd a && ls && fd key enter wait 8000 c.txt -wait 8000 cwd/a Tty +wait 8000 cwd/a Term stable 700 20000 snap listed press right 6 8 diff --git a/test/snapshots/look-file-1col.snap b/test/snapshots/look-file-1col.snap index 490aaf38..1b23e054 100644 --- a/test/snapshots/look-file-1col.snap +++ b/test/snapshots/look-file-1col.snap @@ -1,5 +1,5 @@ # single narrow column (-n 1): the first document splits below its source -# shell, like Tty. A new column would require at least 200 cells of width. +# shell, like Term. A new column would require at least 200 cells of width. lines big.txt 60 start 31 100 -n 1 wait 8000 big.txt diff --git a/test/snapshots/ttyclick.snap b/test/snapshots/ttyclick.snap index 65b6f9fc..534005b9 100644 --- a/test/snapshots/ttyclick.snap +++ b/test/snapshots/ttyclick.snap @@ -18,8 +18,8 @@ snap tty-bodyclick # tag edit from tty: the box still reads `$` while the tag is typed into (the # tag's mode is its own: a clicked tag is in normal mode), and `:` hands the keyboard back — a bug # that lost the body's mode would show `•` in one snap or the other -press left @Tty 3 -release left @Tty 3 +press left @Term 3 +release left @Term 3 stable 400 5000 snap tty-tagedit key : diff --git a/test/snapshots/ttyonly.snap b/test/snapshots/ttyonly.snap index 1008e084..0c2d8738 100644 --- a/test/snapshots/ttyonly.snap +++ b/test/snapshots/ttyonly.snap @@ -1,6 +1,6 @@ -# --tty: a single fullscreen shell already in raw tty mode, prompts visible +# --tui: a single fullscreen shell already in raw tty mode, prompts visible file t.txt x -start 31 100 --tty +start 31 100 --tui wait 8000 $ stable 700 20000 text echo TTY''ONLY diff --git a/test/soak.py b/test/soak.py index e3ff18c7..99f43cc9 100644 --- a/test/soak.py +++ b/test/soak.py @@ -935,7 +935,7 @@ class Run: self.safe_tags() # Two shells beside the directory, as the user's had. for _ in range(self.shells): - self.nine_write('/pane/1/exec', b'Tty\n') + self.nine_write('/pane/1/exec', b'Term\n') time.sleep(0.5) def session_alive(self): @@ -1027,7 +1027,7 @@ class BoxRun(Run): self.session_pid = int(dict(line.split(maxsplit=1) for line in status.splitlines())['pid']) self.safe_tags() for _ in range(self.shells): - self.nine_write('/pane/1/exec', b'Tty\n') + self.nine_write('/pane/1/exec', b'Term\n') time.sleep(1) def session_alive(self): @@ -1633,7 +1633,7 @@ def local_session(run, kind): run.nine = None wait_for(f'{name}\'s 9P', run.nine_sock.exists, timeout=30) wait_for(f'{name}\'s first frame', c.ready, timeout=30) - run.nine_write('/pane/1/exec', b'Tty\n') + run.nine_write('/pane/1/exec', b'Term\n') time.sleep(1) run.instant_panes = instant_panes(run) run.nine_write(f'/pane/{run.instant_panes[1]}/body', b'seq 1 3000\n') diff --git a/test/tag_cleanup.py b/test/tag_cleanup.py index ae0a0e66..80bdb4b0 100644 --- a/test/tag_cleanup.py +++ b/test/tag_cleanup.py @@ -30,11 +30,11 @@ def run(args): pdf = next(serial for serial, tag in panes(client).items() if str(source) in tag) pdf_tag = client.read(f'/pane/{pdf}/tag').decode().strip() require(pdf_tag.startswith(str(source) + ' [1/'), 'PDF name/page prefix missing') - require(pdf_tag.endswith('] Tty Del PdfSections PdfTint Collapse'), 'PDF commands missing') + require(pdf_tag.endswith('] Term Del PdfSections PdfTint Collapse'), 'PDF commands missing') require(all(word not in pdf_tag for word in ['PdfFit', 'filtered', 'full', 'disabled']), 'PDF tag contains fit or tint-state clutter') control = new_pane(client, b'') before = set(panes(client)) - execute(client, control, 'Tty') + execute(client, control, 'Term') tty = require(wait_for(lambda: next((s for s in panes(client) if s not in before), None)), 'terminal missing') client.write(f'/pane/{control}/exec', b'Del\n') # owned command-only scratch diff --git a/test/ui_review.py b/test/ui_review.py index a1cdcdeb..3232c519 100644 --- a/test/ui_review.py +++ b/test/ui_review.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Capture a read-only Agave review in an isolated SDL or TTY session. +"""Capture a read-only Agave review in an isolated SDL or TUI session. python3 test/ui_review.py zig-out/bin/pardes-gui /tmp/pardes-review \\ --project /path/to/agave --theme orchard @@ -36,7 +36,7 @@ def command(client, serial, text): """Execute a temporary tag command without changing source contents.""" tag = f'/pane/{serial}/tag' before = client.read(tag).rstrip(b'\n') - tail_start = before.index(b'Save Tty Del') + tail_start = before.index(b'Save Term Del') while tail_start and before[tail_start - 1:tail_start] == b' ': tail_start -= 1 client.write(tag, b' ' + text.encode()) @@ -120,10 +120,10 @@ def run(args): if grep_pane: (root / 'grep-results.txt').write_bytes(client.read(f'/pane/{grep_pane}/body')) capture(client, root, '03-grep', not args.tty) - command(client, source, 'Tty') + command(client, source, 'Term') terminal = require(wait_for(lambda: next((serial for serial in panes(client) if 'pty' in client.list(f'/pane/{serial}')), None)), - 'Tty did not create a terminal') + 'Term did not create a terminal') if terminal: client.write(f'/pane/{terminal}/pty/data', b"printf '\\033[1;36mAgave workspace\\033[0m\\n'; pwd; printf '\\033[32mRead-only UI review ready\\033[0m\\n'\r") require(wait_for(lambda: b'\nRead-only UI review ready\n' in diff --git a/test/window_opacity.py b/test/window_opacity.py index 0253e15c..2664ff8c 100644 --- a/test/window_opacity.py +++ b/test/window_opacity.py @@ -46,7 +46,7 @@ def run(args): source = require(wait_for(lambda: next((serial for serial, tag in panes(client).items() if str(source_path) in tag), None)), 'source missing') before = set(panes(client)) - command(client, source, 'Tty') + command(client, source, 'Term') terminal = require(wait_for(lambda: next((serial for serial in panes(client) if serial not in before), None)), 'terminal missing') client.write(f'/pane/{terminal}/pty/data', diff --git a/test/yazi_preview.py b/test/yazi_preview.py index 7fa02aa6..4c64b2a7 100644 --- a/test/yazi_preview.py +++ b/test/yazi_preview.py @@ -105,7 +105,7 @@ def run(args): with session('/bin/sh', root, name, socket_name=name, tty=True, launch=launch, inherited=inherited) as (client, _): scratch = new_pane(client, b'') before = panes(client) - execute(client, scratch, 'Tty') + execute(client, scratch, 'Term') term = require(wait_for(lambda: next((s for s in panes(client) if s not in before and 'pty' in client.list(f'/pane/{s}')), None)), 'no terminal') client.remove(f'/pane/{scratch}') diff --git a/tools/gen_builtins_json.zig b/tools/gen_builtins_json.zig index 71df5307..3158c8b2 100644 --- a/tools/gen_builtins_json.zig +++ b/tools/gen_builtins_json.zig @@ -1,4 +1,4 @@ -//! Writes every builtin as JSON to the path given (docs/typ/builtins-<tty|gui>.json, +//! Writes every builtin as JSON to the path given (docs/typ/builtins-<tui|gui>.json, //! by way of `zig build builtins-json`). const std = @import("std"); const pardes = @import("pardes"); diff --git a/tools/shared_libs_check.zig b/tools/shared_libs_check.zig index 7b3174e4..d475f631 100644 --- a/tools/shared_libs_check.zig +++ b/tools/shared_libs_check.zig @@ -1,6 +1,6 @@ //! One copy of each codec in a pardes binary (docs/shared-libs.md). //! -//! zig build shared-libs-check -Dplatform=tty|gui +//! zig build shared-libs-check -Dplatform=tui|gui //! //! Reads the linked executable's ELF symbol table and fails when a family of //! symbols the build has chosen against is in it: a second PNG, JPEG or |
