diff --git a/src/shell-integration/zsh/ghostty-integration b/src/shell-integration/zsh/ghostty-integration index febf3e59c..3fb3ec19b 100644 --- a/src/shell-integration/zsh/ghostty-integration +++ b/src/shell-integration/zsh/ghostty-integration @@ -201,11 +201,11 @@ _ghostty_deferred_init() { _ghostty_report_pwd if [[ "$GHOSTTY_SHELL_FEATURES" == *"title"* ]]; then - # Enable terminal title changes. + # Enable terminal title changes, formatted for user-friendly display. functions[_ghostty_precmd]+=" builtin print -rnu $_ghostty_fd \$'\\e]2;'\"\${(%):-%(4~|…/%3~|%~)}\"\$'\\a'" functions[_ghostty_preexec]+=" - builtin print -rnu $_ghostty_fd \$'\\e]2;'\"\${(V)1}\"\$'\\a'" + builtin print -rnu $_ghostty_fd \$'\\e]2;'\"\${1//[[:cntrl:]]}\"\$'\\a'" fi if [[ "$GHOSTTY_SHELL_FEATURES" == *"cursor"* ]]; then