1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-22 12:20:07 +00:00

call p10k-on-pre-prompt on every precmd; call widget hooks right after when in zle

This commit is contained in:
romkatv 2020-02-16 17:16:12 +01:00
parent 3fe66ba74a
commit 7c1cc0c487

View file

@ -5773,11 +5773,18 @@ function _p9k_on_expand() {
(( $+functions[p10k-on-pre-prompt] )) && p10k-on-pre-prompt (( $+functions[p10k-on-pre-prompt] )) && p10k-on-pre-prompt
__p9k_reset_state=0 if zle; then
_p9k__last_tty=$P9K_TTY local -a P9K_COMMANDS=($_p9k__last_commands)
P9K_TTY=old local pat idx var
for pat idx var in $_p9k_show_on_command; do
if ! zle; then if (( $P9K_COMMANDS[(I)$pat] )); then
_p9k_display_segment $idx $var show
else
_p9k_display_segment $idx $var hide
fi
done
(( $+functions[p10k-on-post-widget] )) && p10k-on-post-widget
else
if [[ $_p9k__display_v[2] == print && -n $_p9k_t[_p9k_empty_line_idx] ]]; then if [[ $_p9k__display_v[2] == print && -n $_p9k_t[_p9k_empty_line_idx] ]]; then
print -rnP -- '%b%k%f%E'$_p9k_t[_p9k_empty_line_idx] print -rnP -- '%b%k%f%E'$_p9k_t[_p9k_empty_line_idx]
fi fi
@ -5792,6 +5799,10 @@ function _p9k_on_expand() {
} }
fi fi
fi fi
__p9k_reset_state=0
_p9k__last_tty=$P9K_TTY
P9K_TTY=old
fi fi
} }
functions -M _p9k_on_expand functions -M _p9k_on_expand
@ -5810,9 +5821,7 @@ _p9k_precmd_impl() {
if zle; then if zle; then
__p9k_new_status=0 __p9k_new_status=0
__p9k_new_pipestatus=(0) __p9k_new_pipestatus=(0)
_p9k__expanded=1
else else
_p9k__expanded=0
_p9k__must_restore_prompt=0 _p9k__must_restore_prompt=0
fi fi
@ -5879,6 +5888,8 @@ _p9k_precmd_impl() {
_p9k_worker_invoke ${f_compute%% *} ${(e)f_compute} _p9k_worker_invoke ${f_compute%% *} ${(e)f_compute}
done done
_p9k__expanded=0
_p9k__refresh_reason=precmd _p9k__refresh_reason=precmd
_p9k_set_prompt _p9k_set_prompt
_p9k__refresh_reason='' _p9k__refresh_reason=''