From b38b38d17da6c0fc592e3506849a8b888de1f572 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 19 Aug 2025 09:23:48 +0530 Subject: [PATCH] Do the same for bash and also sanitize control chars in zsh --- shell-integration/bash/kitty.bash | 5 ++++- shell-integration/zsh/kitty-integration | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shell-integration/bash/kitty.bash b/shell-integration/bash/kitty.bash index dd2760c98..e6936c36e 100644 --- a/shell-integration/bash/kitty.bash +++ b/shell-integration/bash/kitty.bash @@ -353,7 +353,10 @@ _ksi_main() { fi fi builtin unset KITTY_IS_CLONE_LAUNCH KITTY_CLONE_SOURCE_STRATEGIES - if [[ -n "$krcs" ]]; then builtin eval "$krcs"; fi + if [[ -n "$krcs" ]]; then builtin + builtin printf "\e]2;%s\a" "${krcs//[[:cntrl:]]}" # removes any control characters + eval "$krcs"; + fi } _ksi_main builtin unset -f _ksi_main diff --git a/shell-integration/zsh/kitty-integration b/shell-integration/zsh/kitty-integration index 6f9d83049..d456d47e4 100644 --- a/shell-integration/zsh/kitty-integration +++ b/shell-integration/zsh/kitty-integration @@ -352,7 +352,7 @@ _ksi_deferred_init() { # run startup command if [[ -n "$krcs" ]]; then - builtin print -nu "$_ksi_fd" -f '\e]2;%s\e\\' "$krcs" + builtin print -nu "$_ksi_fd" -f '\e]2;%s\e\\' -- "${(V)krcs}" builtin eval "$krcs" fi