From a271f85cd25d2cda2cfbe658a6f2d13ac08494a8 Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Thu, 12 Feb 2026 11:49:44 -0500 Subject: [PATCH] bash: preserve existing PS0 value We were previously overwriting PS0 on every PROMPT_COMMAND. We now append to PS0, but only if it doesn't already contain our hook. This is also more consistent with the bash-preexec behavior we maintain for older bash versions. --- src/shell-integration/bash/ghostty.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shell-integration/bash/ghostty.bash b/src/shell-integration/bash/ghostty.bash index 65a49a190..1a9f4693f 100644 --- a/src/shell-integration/bash/ghostty.bash +++ b/src/shell-integration/bash/ghostty.bash @@ -278,7 +278,9 @@ if (( BASH_VERSINFO[0] > 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 4) ) __ghostty_hook() { builtin local ret=$? __ghostty_precmd "$ret" - PS0=$__ghostty_ps0 + if [[ "$PS0" != *"$__ghostty_ps0"* ]]; then + PS0=$PS0"${__ghostty_ps0}" + fi } # Append our hook to PROMPT_COMMAND, preserving its existing type.