50c678687e73d1433f278b7bb7f168e8fa817670

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(termsupport): fix pwd report for Konsole (#11730)

The Konsole terminal shows an error if the host is provided in the
OSC 7 sequence.

Fixes #11730

Diff

 1diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
 2index cf8f08741a896db2b4a78ec268b643b802e37293..1459827059c3d7c37d6dbbf84b873066bfcb71e3 100644
 3--- a/lib/termsupport.zsh
 4+++ b/lib/termsupport.zsh
 5@@ -150,8 +150,11 @@ function omz_termsupport_cwd {
 6   URL_HOST="$(omz_urlencode -P $HOST)" || return 1
 7   URL_PATH="$(omz_urlencode -P $PWD)" || return 1
 8 
 9+  # Konsole errors if the HOST is provided
10+  [[ -z "$KONSOLE_VERSION" ]] || URL_HOST=""
11+
12   # common control sequence (OSC 7) to set current host and path
13-  printf "\e]7;%s\a" "file://${URL_HOST}${URL_PATH}"
14+  printf "\e]7;file://%s%s\e\\" "${URL_HOST}" "${URL_PATH}"
15 }
16 
17 # Use a precmd hook instead of a chpwd hook to avoid contaminating output