From a2af168eb4099cd2f19fcb671ef6b5d55f5bc7f9 Mon Sep 17 00:00:00 2001 From: romkatv Date: Fri, 6 Mar 2020 10:16:02 +0100 Subject: [PATCH] terminate links with ST instead of BEL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda. The sequence is terminated with ST (string terminator) which is typically ESC \. (Although ST is the standard sequence according to ECMA-48 ยง8.3.89, often the BEL (\a) character is used instead. This nonstandard choice originates from XTerm, and was later adopted by probably all terminal emulators to terminate OSC sequences. Nevertheless, we encourage the use of the standard ST.) --- internal/p10k.zsh | 8 ++++---- internal/wizard.zsh | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index e00a01c0..49ee2a59 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -1980,8 +1980,8 @@ prompt_dir() { local content="${(pj.$sep.)parts}" if (( _POWERLEVEL9K_DIR_HYPERLINK )); then - local header=$'%{\e]8;;file://'${${_p9k__cwd//\%/%%25}//'#'/%%23}$'\a%}' - local footer=$'%{\e]8;;\a%}' + local header=$'%{\e]8;;file://'${${_p9k__cwd//\%/%%25}//'#'/%%23}$'\e\\%}' + local footer=$'%{\e]8;;\e\\%}' if (( expand )); then _p9k_escape $header header=$_p9k__ret @@ -5921,7 +5921,7 @@ function _p9k_clear_instant_prompt() { echo -E - "${(%):- * Zsh will start %Bquickly%b but prompt will %Bjump down%b after initialization.}" echo -E - "" echo -E - "${(%):-For details, see:}" - echo - "${(%):-\e]8;;https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\ahttps://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\e]8;;\a}" + echo - "${(%):-\e]8;;https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\e\\https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\e]8;;\e\\}" echo -E - "" echo - "${(%):-%3F-- console output produced during zsh initialization follows --%f}" echo -E - "" @@ -7840,7 +7840,7 @@ _p9k_init() { >&2 echo -E - "${(%):-You can:}" >&2 echo -E - "" >&2 echo -E - "${(%):- - %BRecommended%b: Change the way Powerlevel10k is loaded from %B$__p9k_zshrc_u%b.}" - >&2 echo - "${(%):- See \e]8;;https://github.com/romkatv/powerlevel10k/blob/master/README.md#installation\ahttps://github.com/romkatv/powerlevel10k/blob/master/README.md#installation\e]8;;\a.}" + >&2 echo - "${(%):- See \e]8;;https://github.com/romkatv/powerlevel10k/blob/master/README.md#installation\e\\https://github.com/romkatv/powerlevel10k/blob/master/README.md#installation\e]8;;\e\\.}" if (( $+functins[zplugin] )); then >&2 echo -E - "${(%):- NOTE: If using %2Fzplugin%f to load %3F'romkatv/powerlevel10k'%f, %Bdo not apply%b %1Fice wait%f.}" fi diff --git a/internal/wizard.zsh b/internal/wizard.zsh index 6dc380bd..4d91f95c 100755 --- a/internal/wizard.zsh +++ b/internal/wizard.zsh @@ -152,7 +152,8 @@ function print_prompt() { } function href() { - print -r -- $'%{\e]8;;'${1//\%/%%}$'\a%}'${1//\%/%%}$'%{\e]8;;\a%}' + local url=${${1//\%/%%}//\\/\\\\} + print -r -- '%{\e]8;;'$url'\e\\%}'$url'%{\e]8;;\e\\%}' } function flowing() {