From 0f9944190d9f73f48d7557dbd11f6d53333400fc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 22 Oct 2021 12:19:03 +0530 Subject: [PATCH] Shell integration: Better fix for multi-line prompts in bash Also fix bash redrawing only the last PS2 prompt --- shell-integration/kitty.bash | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shell-integration/kitty.bash b/shell-integration/kitty.bash index 45ecb4eda..29aaff5fb 100644 --- a/shell-integration/kitty.bash +++ b/shell-integration/kitty.bash @@ -40,7 +40,12 @@ _ksi_main() { fi if [[ "${_ksi_prompt[mark]}" == "y" ]]; then - PS1="\[\e]133;A;does_not_redraw_multiline_prompt\a\]$PS1" + # bash does not redraw the leading lines in a multiline prompt so + # mark them as secondary prompts + local secondary_prompt="\[\e]133;A;k=s\a\]" + PS1=${PS1//\n/\n"$secondary_prompt"} + PS1="\[\e]133;A\a\]$PS1" + PS2="\[\e]133;A;k=s\a\]$PS2" PS0="\[\e]133;C\a\]$PS0" fi