summaryrefslogtreecommitdiff
path: root/lib/termsupport.zsh
diff options
context:
space:
mode:
authorStephen Heuer <sheuer@int42.org>2020-02-28 12:50:17 -0600
committerGitHub <noreply@github.com>2020-02-28 19:50:17 +0100
commita2cad16790aeb7e775da47fd11f1f7cee1e03c90 (patch)
tree159314bc1fc1b1ee0efa22b7d5e5823c409a4dc5 /lib/termsupport.zsh
parent864b441688efee6573d233b21075a6f23a903097 (diff)
downloadzsh-a2cad16790aeb7e775da47fd11f1f7cee1e03c90.tar.gz
zsh-a2cad16790aeb7e775da47fd11f1f7cee1e03c90.tar.bz2
zsh-a2cad16790aeb7e775da47fd11f1f7cee1e03c90.zip
lib: urlencode hostname in update_terminalapp_cwd (#6245)
Apple's Terminal doesn't open a new tab in your current directory if your hostname has UTF-8 characters in it. Percent encoding the host in addition to the path in update_terminalapp_cwd appears to solve this issue. Co-authored-by: Marc Cornellà <marc.cornella@live.com>
Diffstat (limited to 'lib/termsupport.zsh')
-rw-r--r--lib/termsupport.zsh9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
index f5e367fcb..19fd57b9d 100644
--- a/lib/termsupport.zsh
+++ b/lib/termsupport.zsh
@@ -91,12 +91,13 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
function update_terminalapp_cwd() {
emulate -L zsh
- # Percent-encode the pathname.
- local URL_PATH="$(omz_urlencode -P $PWD)"
- [[ $? != 0 ]] && return 1
+ # Percent-encode the host and path names.
+ local URL_HOST URL_PATH
+ URL_HOST="$(omz_urlencode -P $HOST)" || return 1
+ URL_PATH="$(omz_urlencode -P $PWD)" || return 1
# Undocumented Terminal.app-specific control sequence
- printf '\e]7;%s\a' "file://$HOST$URL_PATH"
+ printf '\e]7;%s\a' "file://$URL_HOST$URL_PATH"
}
# Use a precmd hook instead of a chpwd hook to avoid contaminating output