1
1
mirror of https://github.com/wez/wezterm.git synced 2025-01-07 06:26:51 +03:00

shell integration: check for saved PS1 value before using it

On bash it's possible to hit ^C before we remembered the PS1 which would
cause the shell to end up with an empty PS1, making it unclear that the
^C actually worked as there is no prompt left.

I'm not sure I understand the need to mess with the variable every time
(could just add the OSC codes if not already present and never remove
them?), but at least make it so we don't end up with an empty prompt
line by checking the saved value isn't empty.
This commit is contained in:
Dominique Martinet 2024-08-20 17:04:45 +09:00 committed by Wez Furlong
parent 1eddc9157f
commit 24702de74a

View File

@ -486,9 +486,12 @@ __wezterm_semantic_precmd() {
}
function __wezterm_semantic_preexec() {
# Restore the original PS1/PS2
PS1="$__wezterm_save_ps1"
PS2="$__wezterm_save_ps2"
# Restore the original PS1/PS2 if set
if [ -n "${__wezterm_save_ps1+1}" ]; then
PS1=$__wezterm_save_ps1"
PS2="$__wezterm_save_ps2"
unset __wezterm_save_ps1
fi
# Indicate that the command output begins here
printf "\033]133;C;\007"
__wezterm_semantic_precmd_executing=1