From cc1bf55b9996d556080c4104e211f24508b29cd8 Mon Sep 17 00:00:00 2001 From: Jonas Maier Date: Sat, 9 May 2026 17:25:28 +0200 Subject: can set custom prompt using the PROMPT variable --- src/run/builtin.rs | 5 ++++- src/run/mod.rs | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/run') diff --git a/src/run/builtin.rs b/src/run/builtin.rs index f085005..bd82e27 100644 --- a/src/run/builtin.rs +++ b/src/run/builtin.rs @@ -836,7 +836,10 @@ impl Builtin for ct { b"cursor_right_word" => se.cursor_right_word(), b"cursor_left_word" => se.cursor_left_word(), b"prompt_clear" => se.prompt_clear(), - b"screen_clear" => se.screen_clear(), + b"screen_clear" => { + drop(se); + Session::screen_clear(session); + }, b"history_previous" => se.history_up(), b"history_next" => se.history_down(), b"prompt_del_left" => se.del_left(), diff --git a/src/run/mod.rs b/src/run/mod.rs index 7e575ce..bae9567 100644 --- a/src/run/mod.rs +++ b/src/run/mod.rs @@ -463,6 +463,11 @@ impl parse::Expander for Executor { var: BString, default: Option, ) -> Result { + match &var[..] { + b"CWD_PRETTY" => return Ok(crate::pretty_cwd().into_bytes()), + _ => {} + } + if var.is_empty() { return Err(ExecError::UnknownVariable(var)); } @@ -610,7 +615,8 @@ pub fn run(se: Arc>, parsed: Ast) { Err(e) => format!("{}\r\n", e.error_message()), }; - print!("\r{status_string}{}", se.lock().unwrap().prompt()); + print!("\r{status_string}"); + Session::reprint_prompt(se); let _ = std::io::stdout().lock().flush(); } } -- cgit v1.2.3