aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-10-21 12:14:33 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-10-21 12:14:33 +0300
commit981774f178b949c56affe83c865e6c94e3d34156 (patch)
treef80b1bbc0de74fad7efae7ab894ad2f1aa8ce27c /internal/p10k.zsh
parent6dbe2c860c490db50e0257f2233b7c9d31c3c577 (diff)
better workaround for the lying `stty size`
See https://github.com/gnunn1/tilix/issues/1777.
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r--internal/p10k.zsh20
1 files changed, 18 insertions, 2 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 97410aba..b7902990 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -3490,7 +3490,7 @@ _p9k_set_instant_prompt() {
RPROMPT=$saved_rprompt
}
-typeset -gri __p9k_instant_prompt_version=6
+typeset -gri __p9k_instant_prompt_version=7
_p9k_dump_instant_prompt() {
local user=${(%):-%n}
@@ -3536,7 +3536,23 @@ _p9k_dump_instant_prompt() {
local -a _p9k_t=("${(@ps:$us:)${tail%%$rs*}}")'
(( __p9k_ksh_arrays )) && >&$fd print -r -- ' setopt ksh_arrays'
(( __p9k_sh_glob )) && >&$fd print -r -- ' setopt sh_glob'
- >&$fd print -r -- ' [[ -x /bin/stty ]] && /bin/stty size >/dev/null
+ >&$fd print -r -- ' if [[ $LINES == (24|0) && $COLUMNS == (80|0) && -x /bin/stty ]]; then
+ setopt monitor trapsasync
+ zmodload zsh/datetime
+ zmodload zsh/system
+ local -F deadline=$((EPOCHREALTIME+0.03))
+ local -i fd pid
+ trap "kill -- -\$pid 2>/dev/null" WINCH
+ exec {fd}< <(
+ echo $sysparams[pid]
+ while [[ $LINES == (24|0) && $COLUMNS == (80|0) && $EPOCHREALTIME -lt $deadline &&
+ "$(/bin/stty size 2>/dev/null)" == (24|0)\ (80|0) ]]; do
+ done)
+ IFS= read -u $fd pid
+ ( read -u $fd ) 2>/dev/null
+ exec {fd}>&-
+ trap - WINCH
+ fi
typeset -ga __p9k_used_instant_prompt=("${(@e)_p9k_t[-3,-1]}")'
(( __p9k_ksh_arrays )) && >&$fd print -r -- ' unsetopt ksh_arrays'
(( __p9k_sh_glob )) && >&$fd print -r -- ' unsetopt sh_glob'