aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2022-01-26 17:03:22 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2022-01-26 17:03:22 +0300
commitd6f8c477617d57363d0e2c28977ef815e5a675a2 (patch)
tree6153b11e7fe18a864c895669bcf316f83c1e9391 /internal/p10k.zsh
parentcead0349c57f27521b8307b4651a5c077e6bb276 (diff)
survive broken $TMPDIR
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r--internal/p10k.zsh18
1 files changed, 14 insertions, 4 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 9d60963c..f1c8cd29 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -6280,8 +6280,13 @@ _p9k_dump_instant_prompt() {
out+="$cr${(pl:$((height-prompt_height))::\n:)}$terminfo[sc]$out"
fi
fi
- typeset -g __p9k_instant_prompt_output=${TMPDIR:-/tmp}/p10k-instant-prompt-output-${(%):-%n}-$$
- { echo -n > $__p9k_instant_prompt_output } || return
+ if [[ -n "$TMPDIR" && ( ( -d "$TMPDIR" && -w "$TMPDIR" ) || ! ( -d /tmp && -w /tmp ) ) ]]; then
+ local tmpdir=$TMPDIR
+ else
+ local tmpdir=/tmp
+ fi
+ typeset -g __p9k_instant_prompt_output=$tmpdir/p10k-instant-prompt-output-${(%):-%n}-$$
+ { : > $__p9k_instant_prompt_output } || return
print -rn -- "${out}${esc}?2004h" || return
if (( $+commands[stty] )); then
command stty -icanon 2>/dev/null
@@ -7802,7 +7807,12 @@ function _p9k_wrap_widgets() {
# There is no zle-line-pre-redraw in zsh < 5.3, so we have to wrap all widgets
# with key bindings. This costs extra 3ms: 1.5ms to fetch the list of widgets and
# another 1.5ms to wrap them.
- local keymap tmp=${TMPDIR:-/tmp}/p10k.bindings.$sysparams[pid]
+ if [[ -n "$TMPDIR" && ( ( -d "$TMPDIR" && -w "$TMPDIR" ) || ! ( -d /tmp && -w /tmp ) ) ]]; then
+ local tmpdir=$TMPDIR
+ else
+ local tmpdir=/tmp
+ fi
+ local keymap tmp=$tmpdir/p10k.bindings.$sysparams[pid]
{
for keymap in $keymaps; do bindkey -M $keymap; done >$tmp
local -aU widget_list=(
@@ -8259,7 +8269,7 @@ _p9k_must_init() {
[[ $sig == $_p9k__param_sig ]] && return 1
_p9k_deinit
fi
- _p9k__param_pat=$'v133\1'${(q)ZSH_VERSION}$'\1'${(q)ZSH_PATCHLEVEL}$'\1'
+ _p9k__param_pat=$'v134\1'${(q)ZSH_VERSION}$'\1'${(q)ZSH_PATCHLEVEL}$'\1'
_p9k__param_pat+=$__p9k_force_term_shell_integration$'\1'
_p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1'
_p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1'