Skip to content

Commit b60acf5

Browse files
committed
Make sure psvar[11] gets updated
1 parent 591ebf7 commit b60acf5

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

agkozak-zsh-prompt.plugin.zsh

+15-2
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ AGKOZAK[FUNCTIONS]='_agkozak_debug_print
124124
_agkozak_set_git_psvars
125125
_agkozak_zle-keymap-select
126126
TRAPWINCH
127+
_agkozak_update_psvar11
127128
TRAPCHLD
128129
_agkozak_vi_mode_indicator
129130
_agkozak_load_async_lib
@@ -518,11 +519,23 @@ TRAPWINCH() {
518519
}
519520

520521
############################################################
521-
# Redraw the prompt when the background jobs count changes
522+
# Help TRAPCHLD update psvar[11]
523+
#
524+
# See https://zsh.org/mla/workers/2016/msg00257.html
522525
############################################################
523-
TRAPCHLD() {
526+
_agkozak_update_psvar11() {
527+
unset "AGKOZAK[TRAPCHLD_CALLED]"
524528
psvar[11]=${${(%):-%j}#0}
525529
zle && zle reset-prompt
530+
(( AGKOZAK[TRAPCHLD_CALLED] )) && _agkozak_update_psvar11
531+
}
532+
533+
############################################################
534+
# Redraw the prompt when the background jobs count changes
535+
############################################################
536+
TRAPCHLD() {
537+
_agkozak_update_psvar11
538+
AGKOZAK[TRAPCHD_CALLED]=1
526539
}
527540

528541
############################################################

0 commit comments

Comments
 (0)