diff --git a/shell-integration/kitty.zsh b/shell-integration/kitty.zsh index 4e21c03aa..d493f9093 100644 --- a/shell-integration/kitty.zsh +++ b/shell-integration/kitty.zsh @@ -53,6 +53,7 @@ if [[ "$_ksi_prompt[mark]" == "y" ]]; then _ksi_osc "133;$1"; fi } _ksi_prompt[start_mark]="%{$(_ksi_mark A)%}" + _ksi_prompt[secondary_mark]="%{$(_ksi_mark 'A;k=s')%}" function _ksi_set_title() { if [[ "$_ksi_prompt[title]" == "y" ]]; then _ksi_osc "2;$1"; fi @@ -87,6 +88,9 @@ # not called when the prompt is redrawn after a window resize or when a background # job finishes if [[ "$PS1" != *"$_ksi_prompt[start_mark]"* ]]; then PS1="$_ksi_prompt[start_mark]$PS1" fi + # PS2 is used for prompt continuation. On resize with a continued prompt only the last + # prompt is redrawn so we need to mark it + if [[ "$PS2" != *"$_ksi_prompt[secondary_mark]"* ]]; then PS2="$_ksi_prompt[secondary_mark]$PS2" fi fi _ksi_prompt[state]="precmd" } @@ -121,6 +125,7 @@ _ksi_mark "C"; # remove the prompt mark sequence while the command is executing as it could read/modify the value of PS1 PS1="${PS1//$_ksi_prompt[start_mark]/}" + PS2="${PS2//$_ksi_prompt[secondary_mark]/}" fi # Set kitty window title to the currently executing command _ksi_set_title "$1"