4e306887c248f3887a8e163c993f31df5a62487e

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Cleanup update_terminalapp_cwd function

Diff

 1diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
 2index 6271725a28bc252c578a20abe36b07d8728938dc..7cf15b0a0ee2d09775ee03aa7d419cd81961364e 100644
 3--- a/lib/termsupport.zsh
 4+++ b/lib/termsupport.zsh
 5@@ -76,19 +76,18 @@ preexec_functions+=(omz_termsupport_preexec)
 6 # With extra fixes to handle multibyte chars and non-UTF-8 locales
 7 
 8 if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
 9-
10   # Emits the control sequence to notify Terminal.app of the cwd
11+  # Identifies the directory using a file: URI scheme, including
12+  # the host name to disambiguate local vs. remote paths.
13   function update_terminalapp_cwd() {
14     emulate -L zsh
15-    # Identify the directory using a "file:" scheme URL, including
16-    # the host name to disambiguate local vs. remote paths.
17 
18     # Percent-encode the pathname.
19     local URL_PATH="$(omz_urlencode -P $PWD)"
20     [[ $? != 0 ]] && return 1
21-    local PWD_URL="file://$HOST$URL_PATH"
22+
23     # Undocumented Terminal.app-specific control sequence
24-    printf '\e]7;%s\a' $PWD_URL
25+    printf '\e]7;%s\a' "file://$HOST$URL_PATH"
26   }
27 
28   # Use a precmd hook instead of a chpwd hook to avoid contaminating output