Prevent parameter expansion in preprompt

By unsetting `prompt_subst` for the `prompt_pure_preprompt_render`
function we can avoid e.g. git branch names with a `$`-sign to be
expanded as parameters.

Fixes #224 and #225 (as a result of 6cbd49a).
This commit is contained in:
Mathias Fredriksson
2016-08-25 18:59:34 +03:00
parent 753ef290f8
commit 780d1a5a08

View File

@@ -123,6 +123,9 @@ prompt_pure_string_length_to_var() {
}
prompt_pure_preprompt_render() {
# make sure prompt_subst is unset to prevent parameter expansion in prompt
setopt local_options no_prompt_subst
# check that no command is currently running, the preprompt will otherwise be rendered in the wrong place
[[ -n ${prompt_pure_cmd_timestamp+x} && "$1" != "precmd" ]] && return