mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-12 19:18:28 +02:00
remove explicit timeout support from worker
This commit is contained in:
parent
da498aef57
commit
a6e0b01dc1
@ -4500,7 +4500,6 @@ function _p9k_maybe_dump() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _p9k_on_expand() {
|
function _p9k_on_expand() {
|
||||||
_p9k__last_prompt_update_time=EPOCHREALTIME
|
|
||||||
(( _p9k__expanded && ! $+__p9k_instant_prompt_active )) && return
|
(( _p9k__expanded && ! $+__p9k_instant_prompt_active )) && return
|
||||||
|
|
||||||
() {
|
() {
|
||||||
@ -4897,7 +4896,6 @@ typeset -g _p9k__param_pat
|
|||||||
typeset -g _p9k__param_sig
|
typeset -g _p9k__param_sig
|
||||||
|
|
||||||
_p9k_init_vars() {
|
_p9k_init_vars() {
|
||||||
typeset -gF _p9k__last_prompt_update_time
|
|
||||||
typeset -ga _p9k_show_on_command
|
typeset -ga _p9k_show_on_command
|
||||||
typeset -g _p9k__last_buffer
|
typeset -g _p9k__last_buffer
|
||||||
typeset -ga _p9k__last_commands
|
typeset -ga _p9k__last_commands
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
function _p9k_worker_main() {
|
function _p9k_worker_main() {
|
||||||
zmodload zsh/system || return
|
zmodload zsh/system || return
|
||||||
zmodload zsh/zselect || return
|
zmodload zsh/zselect || return
|
||||||
zselect -t0
|
zmodload zsh/datetime || return
|
||||||
(( $? == 1 )) || return
|
! { zselect -t0 || (( $? != 1 )) } || return
|
||||||
|
|
||||||
local req fd
|
local req fd
|
||||||
local -A inflight # fd => id$'\x1f'sync
|
|
||||||
local -a ready
|
local -a ready
|
||||||
local _p9k_worker_tmout # empty or non-negative int, in hundredths of a second
|
local -A inflight # fd => id$'\x1f'sync
|
||||||
while true; do
|
local -ri _p9k_worker_runs_me=1
|
||||||
if zselect -a ready ${_p9k_worker_tmout:+-t$_p9k_worker_tmout} 0 ${(k)inflight}; then
|
while zselect -a ready 0 ${(k)inflight}; do
|
||||||
[[ $ready[1] == -r ]] || return
|
[[ $ready[1] == -r ]] || return
|
||||||
for fd in ${ready:1}; do
|
for fd in ${ready:1}; do
|
||||||
if [[ $fd == 0 ]]; then
|
if [[ $fd == 0 ]]; then
|
||||||
@ -52,10 +51,6 @@ function _p9k_worker_main() {
|
|||||||
unset "inflight[$fd]"
|
unset "inflight[$fd]"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
|
||||||
(( $? == 1 )) || return
|
|
||||||
(( $+functions[_p9k_worker_on_timeout] )) && _p9k_worker_on_timeout
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,17 +72,6 @@ function _p9k_worker_reply() { eval $1 }
|
|||||||
# usage: _p9k_worker_reply <list>
|
# usage: _p9k_worker_reply <list>
|
||||||
function _p9k_worker_reply_remote() { print -rn -- e$1$'\x1e' }
|
function _p9k_worker_reply_remote() { print -rn -- e$1$'\x1e' }
|
||||||
|
|
||||||
# invoked in worker: _p9k_worker_on_timeout
|
|
||||||
function _p9k_worker_on_timeout() {
|
|
||||||
_p9k_worker_tmout=
|
|
||||||
_p9k_worker_reply _p9k_worker_keep_alive
|
|
||||||
}
|
|
||||||
|
|
||||||
# invoked in master: _p9k_worker_keep_alive
|
|
||||||
function _p9k_worker_keep_alive() {
|
|
||||||
_p9k_worker_invoke "" "_p9k_worker_tmout=100" "" ""
|
|
||||||
}
|
|
||||||
|
|
||||||
# invoked in master: _p9k_worker_send_params [param]...
|
# invoked in master: _p9k_worker_send_params [param]...
|
||||||
function _p9k_worker_send_params() {
|
function _p9k_worker_send_params() {
|
||||||
[[ -z $_p9k__worker_resp_fd || $# == 0 ]] && return
|
[[ -z $_p9k__worker_resp_fd || $# == 0 ]] && return
|
||||||
@ -197,16 +181,9 @@ function _p9k_worker_receive() {
|
|||||||
print -r -- "
|
print -r -- "
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
setopt no_hist_expand extended_glob no_prompt_bang prompt_percent prompt_subst no_aliases
|
setopt no_hist_expand extended_glob no_prompt_bang prompt_percent prompt_subst no_aliases
|
||||||
zmodload zsh/system
|
|
||||||
zmodload zsh/datetime
|
|
||||||
function _p9k_worker_main() { $functions[_p9k_worker_main] }
|
function _p9k_worker_main() { $functions[_p9k_worker_main] }
|
||||||
function _p9k_worker_reply() { $functions[_p9k_worker_reply_remote] }" || return
|
function _p9k_worker_reply() { $functions[_p9k_worker_reply_remote] }
|
||||||
if (( _POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME )); then
|
_p9k_worker_main"$'\x1e' || return
|
||||||
print -r -- "function _p9k_worker_on_timeout() {
|
|
||||||
$functions[_p9k_worker_on_timeout] }" || return
|
|
||||||
fi
|
|
||||||
print -r -- "_p9k_worker_main" || return
|
|
||||||
print -rn -- $'\x1e' || return
|
|
||||||
if (( $#_p9k__worker_params )); then
|
if (( $#_p9k__worker_params )); then
|
||||||
print -rn -- $'\x1f' || return
|
print -rn -- $'\x1f' || return
|
||||||
typeset -p -- $_p9k__worker_params || return
|
typeset -p -- $_p9k__worker_params || return
|
||||||
@ -224,7 +201,6 @@ function _p9k_worker_receive() {
|
|||||||
done
|
done
|
||||||
_p9k__worker_request_queue=()
|
_p9k__worker_request_queue=()
|
||||||
} >&$_p9k__worker_req_fd
|
} >&$_p9k__worker_req_fd
|
||||||
(( _POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME )) && _p9k_worker_keep_alive
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
return 1
|
return 1
|
||||||
@ -232,11 +208,7 @@ function _p9k_worker_receive() {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if (( reset ||
|
(( reset )) && _p9k_reset_prompt
|
||||||
_POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME &&
|
|
||||||
_p9k__last_prompt_update_time < EPOCHREALTIME - 0.8 )); then
|
|
||||||
_p9k_reset_prompt
|
|
||||||
fi
|
|
||||||
return 0
|
return 0
|
||||||
} always {
|
} always {
|
||||||
(( $? )) && _p9k_worker_stop
|
(( $? )) && _p9k_worker_stop
|
||||||
@ -281,14 +253,12 @@ function _p9k_worker_start() {
|
|||||||
|
|
||||||
# todo: remove
|
# todo: remove
|
||||||
function _p9k_reset_prompt() {
|
function _p9k_reset_prompt() {
|
||||||
zle && zle reset-prompt && zle -R && _p9k__last_prompt_update_time=EPOCHREALTIME
|
zle && zle reset-prompt && zle -R
|
||||||
}
|
}
|
||||||
|
|
||||||
emulate -L zsh -o prompt_subst # -o xtrace
|
emulate -L zsh -o prompt_subst # -o xtrace
|
||||||
|
|
||||||
POWERLEVEL9K_WORKER_LOG_LEVEL=DEBUG
|
POWERLEVEL9K_WORKER_LOG_LEVEL=DEBUG
|
||||||
_POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME=0
|
|
||||||
typeset -F _p9k__last_prompt_update_time
|
|
||||||
|
|
||||||
zmodload zsh/datetime
|
zmodload zsh/datetime
|
||||||
zmodload zsh/system
|
zmodload zsh/system
|
||||||
|
Loading…
Reference in New Issue
Block a user