Sanitize prompt before starship init (#4269)

Add prompt sanitization to clear stale terminal line state after abnormal exits, preventing prompt artifacts.
This commit is contained in:
James Robey
2026-02-01 23:49:59 +07:00
committed by GitHub
parent 6a5b64b4bc
commit 49a2941e2b

View File

@@ -3,6 +3,9 @@ if command -v mise &> /dev/null; then
fi
if command -v starship &> /dev/null; then
# clear stale readline state before rendering prompt (prevents artifacts in prompt after abnormal exits like SIGQUIT)
__sanitize_prompt() { printf '\r\033[K'; }
PROMPT_COMMAND="__sanitize_prompt${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
eval "$(starship init bash)"
fi