From 8aafc3fa24c7475a07259eb06cd5d217f510df98 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 5 Aug 2026 19:32:30 -0300 Subject: add a Shell builtin, default fish, with per-family prompt integration --- src/pardes.zig | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src/pardes.zig') diff --git a/src/pardes.zig b/src/pardes.zig index 61950562..08536544 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -2232,14 +2232,6 @@ fn pathUnder(a: []const u8, b: []const u8) bool { } const tutor_text = @embedFile("tutor.txt"); -const rc_path = "/tmp/pardes-osc133.bash"; -pub const bash_rc = - \\[ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc" - \\PS1='\[\e]133;A;cl=line\a\]'"$PS1"'\[\e]133;B\a\]' - \\PROMPT_COMMAND='printf "\e]133;D\a"'"${PROMPT_COMMAND:+;$PROMPT_COMMAND}" - \\trap 'printf "\e]133;C\a"' DEBUG - \\ -; // ---- theme ---- @@ -3960,6 +3952,14 @@ pub const Pardes = struct { /// its first theme. No frame is rendered in that interval. animate_theme_changes: bool = false, colors_on: bool = true, + /// The binary a NEW terminal execs (the Shell builtin). Inline and fixed + /// like every other short string the core keeps, and `0` means "the + /// default" rather than a copy of it — so there is no constructor to + /// remember and config.default_shell stays the single place the default is + /// written. Existing panes are not touched: a shell you are already in is + /// a process, not a setting. + shell_buf: [255]u8 = undefined, + shell_len: u8 = 0, /// soft line breaks in file panes (the Wrap builtin). ON by default: a line /// running off the right edge is text you cannot read without scrolling /// sideways for it, and the reason to reach for the toggle is the rare @@ -4322,6 +4322,13 @@ pub const Pardes = struct { return true; } + /// What a shell should exec for the next terminal — a bare name to be + /// looked up, or an absolute path to be used as it stands. The resolving + /// is the shells' half: the core has no filesystem to ask. + pub fn shellBin(p: *const Pardes) []const u8 { + return if (p.shell_len == 0) config.default_shell else p.shell_buf[0..p.shell_len]; + } + /// Post the transient message on `id`'s last row. Called by a SHELL once /// the IO it narrates has actually happened, exactly as openNewFile above /// completes a `new_file` effect: the core neither writes files nor owns a @@ -11033,7 +11040,7 @@ pub const Pardes = struct { /// something that has somewhere to put it. fn takesArg(b: Builtin) bool { switch (b) { - .Restore, .Find, .Grep, .Rename, .WsSymbols, .Theme, .Look, .Exec => return true, + .Restore, .Find, .Grep, .Rename, .WsSymbols, .Theme, .Shell, .Look, .Exec => return true, // Font is a BRANCH and not another name in that prong for the // reason output_pane.traits has the same shape: it is not in the // enum at all off the gui, and a comptime-false `if` is the one -- cgit v1.3