summaryrefslogtreecommitdiff
path: root/Functions/Prompts/prompt_bart_setup
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2017-07-29 16:58:39 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2017-07-29 16:58:39 -0700
commit43e55a9bcd2c90124a751f2597d2f33cb6e3c042 (patch)
tree2fdf9d052a2ec8d0503c23ce8430bf89352cb700 /Functions/Prompts/prompt_bart_setup
parent32ca9222af5ee7d170f0b7f7cb67b03c973c2e98 (diff)
downloadzsh-43e55a9bcd2c90124a751f2597d2f33cb6e3c042.tar.gz
zsh-43e55a9bcd2c90124a751f2597d2f33cb6e3c042.zip
41472: introduce cleanup hooks default and restore special themes, and update documentation
Diffstat (limited to 'Functions/Prompts/prompt_bart_setup')
-rw-r--r--Functions/Prompts/prompt_bart_setup10
1 files changed, 8 insertions, 2 deletions
diff --git a/Functions/Prompts/prompt_bart_setup b/Functions/Prompts/prompt_bart_setup
index cb032de8a..6de412231 100644
--- a/Functions/Prompts/prompt_bart_setup
+++ b/Functions/Prompts/prompt_bart_setup
@@ -16,9 +16,13 @@ prompt_bart_help () {
blue, and the default foreground) are used if no arguments are
given. The defaults look best on a light background.
- The "off" token temporarily disables the theme; "on" restores it.
No background colors or hardwired cursor motion escapes are used,
and it is not necessary to setopt promptsubst.
+
+ The "off" token temporarily disables the theme; "on" restores it.
+ Note, this does NOT fully reset to the original prompt state, it
+ only hides/reveals the extra lines above the command line and
+ removes the supporting hooks.
EOF
[[ $(read -sek 1 "?${(%):-%S[press return]%s}") == [Qq] ]] &&
print -nP '\r%E' && return
@@ -183,7 +187,7 @@ prompt_bart_setup () {
add-zsh-hook -D preexec "prompt_*_preexec"
functions[TRAPWINCH]="${functions[TRAPWINCH]//prompt_bart_winch}"
[[ $prompt_theme[1] = bart ]] && PS1=${${(f)PS1}[-1]}
- return 1
+ return 1 # Prevent change of $prompt_theme
;;
(on|enable)
shift
@@ -224,6 +228,8 @@ prompt_bart_setup () {
add-zsh-hook precmd prompt_bart_precmd
add-zsh-hook preexec prompt_bart_preexec
+ prompt_cleanup \
+ 'functions[TRAPWINCH]="${functions[TRAPWINCH]//prompt_bart_winch}"'
functions[TRAPWINCH]="${functions[TRAPWINCH]//prompt_bart_winch}
prompt_bart_winch"