Compare commits

...

7 Commits

Author SHA1 Message Date
b166er c622280bab
Merge 21de7e270c into 9253fb1c50 2026-07-21 09:14:00 -07:00
b166er 21de7e270c
Merge branch 'master' into android-battery-fix 2026-07-21 09:13:56 -07:00
Roman Perepelitsa 9253fb1c50 fix a bug that triggers when SH_GLOB is set (#2887) 2026-06-15 09:54:55 +02:00
Roman Perepelitsa a0c9dbe80b bump version 2026-06-02 20:20:51 +02:00
George Nachman 31982e202d
emit OSC 133 k=r and k=s for iTerm2 >= 3.7.0 (#2954)
iTerm2 3.7.0 added receiver support for the OSC 133 k= attribute
(Semantic Prompt prompt kinds: k=i initial, k=s secondary/PS2,
k=c continuation, k=r right). When emitted by the shell, iTerm2
records the bracketed cells as non-input on the active primary
prompt mark, so consumers (Select Current Command, share-as-URL,
AI prompt extraction, the Python GetPromptResponse.excluded_subranges
field) can subtract them from the typed-command range.

Two gaps for iTerm2 today:

1. The RPROMPT k=r wrap in _p9k_init_prompt is gated to WarpTerminal.
   iTerm2 sessions never trip the gate, so right-prompt cells leak
   into "Select Current Command", share URLs, etc.

2. p10k replaces iTerm2's iterm2_decorate_prompt with a stub that
   only records ITERM2_PRECMD_PS1. iTerm2's original function also
   wraps PS2 with OSC 133; the stub drops that wrap entirely, so
   multi-line input (for, while, unclosed quotes, heredocs, backslash
   continuations) produces no k=s markers and iTerm2 has no way to
   tell PS2-prefix cells apart from user input.

Both fixes are gated on iTerm2 >= 3.7.0 via
TERM_PROGRAM_VERSION == (3.<7->*|<4->.*). Older iTerm2 receivers do
not parse k= and would treat k=r/k=s markers as spurious primary
prompts (extra navigation marks, broken command-range tracking,
broken paste-each-line semantics). WarpTerminal behavior is
unchanged. The ITERM2_SQUELCH_PS2_MARK opt-out from iTerm2's
original iterm2_decorate_prompt is preserved.
2026-06-02 20:16:25 +02:00
Don Collins 88389386f0 Accidently broke linux, fixed it 2025-05-09 08:43:51 -07:00
Don Collins ed65b4152d Added check for Android in battery segment, and use termux-battery-status if true to avoid needing root 2025-05-09 04:51:52 -07:00
2 changed files with 250 additions and 60 deletions

View File

@ -138,6 +138,14 @@ function getColorCode() {
return 1
}
function _p9k_codeset_is_utf8() {
# Use `case` to survive SH_GLOB.
case "${langinfo[CODESET]}" in
utf-8|UTF-8|utf8|UTF8) return 0;;
*) return 1;;
esac
}
# _p9k_declare <type> <uppercase-name> [default]...
function _p9k_declare() {
local -i set=$+parameters[$2]
@ -1334,7 +1342,22 @@ _p9k_prompt_fvm_init() {
################################################################
# Segment that displays the battery status in levels and colors
prompt_battery() {
[[ $_p9k_os == (Linux|Android) ]] && _p9k_prompt_battery_set_args
# The condition '[[ $_p9k_os == (Linux|Android) ]]' is fine.
# _p9k_prompt_battery_set_args will internally distinguish between Linux and Android.
[[ $_p9k_os == (Linux|Android|OSX) ]] && _p9k_prompt_battery_set_args # Adjusted to include OSX here as it also calls set_args indirectly or directly. Original was (Linux|Android)
# A more direct check: call _p9k_prompt_battery_set_args if it's an OS we attempt to handle in set_args.
# However, the original structure implies set_args is mainly for Linux/Android, OSX has async.
# Let's stick to modifying set_args and init, the top call can remain as is if OSX path doesn't call set_args directly from here.
# On review, OSX path in init adds to _p9k__async_segments_compute, which calls _p9k_prompt_battery_compute -> _p9k_prompt_battery_async -> _p9k_prompt_battery_set_args.
# So, the original condition in prompt_battery might be part of a different flow or slightly redundant if async is used.
# For safety, let's assume _p9k_prompt_battery_set_args is potentially called for supported OSes.
# The original condition was: [[ $_p9k_os == (Linux|Android) ]] && _p9k_prompt_battery_set_args
# This means for OSX, this direct call to _p9k_prompt_battery_set_args was not made.
# The async path for OSX calls _p9k_prompt_battery_set_args.
# So, the original conditional call here is likely for non-async/fallback paths for Linux/Android.
if [[ $_p9k_os == Linux || $_p9k_os == Android ]]; then
_p9k_prompt_battery_set_args
fi
(( $#_p9k__battery_args )) && _p9k_prompt_segment "${_p9k__battery_args[@]}"
}
@ -1344,8 +1367,26 @@ _p9k_prompt_battery_init() {
_p9k__async_segments_compute+='_p9k_worker_invoke battery _p9k_prompt_battery_compute'
return
fi
if [[ $_p9k_os != (Linux|Android) ||
-z /sys/class/power_supply/(CMB*|BAT*|*battery)/(energy_full|charge_full|charge_counter)(#qN) ]]; then
# Condition for disabling the segment
local should_disable_segment=0
if [[ $_p9k_os == Android ]]; then
# On Android, disable if termux-battery-status is not available
(( ! $+commands[termux-battery-status] )) && should_disable_segment=1
elif [[ $_p9k_os == Linux ]]; then
# On Linux, disable if sysfs battery info is not available
# Original check: -z /sys/class/power_supply/(CMB*|BAT*|*battery)/(energy_full|charge_full|charge_counter)(#qN)
# This checks if the glob expands to nothing (zero files found).
# We need to ensure this runs in a context where zsh globbing features are active.
# (FN) was used in set_args, implies it. (#qN) means quiet, nullglob.
if (( ${#$(echo /sys/class/power_supply/(CMB*|BAT*|*battery)/(energy_full|charge_full|charge_counter)(N)):-0} == 0 )); then
should_disable_segment=1
fi
elif [[ $_p9k_os != OSX ]]; then # If not OSX, Android, or Linux
should_disable_segment=1 # Disable for other unsupported OS by default
fi
if (( should_disable_segment )); then
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='${:-}'
fi
}
@ -1356,7 +1397,7 @@ _p9k_prompt_battery_compute() {
_p9k_prompt_battery_async() {
local prev="${(pj:\0:)_p9k__battery_args}"
_p9k_prompt_battery_set_args
_p9k_prompt_battery_set_args # This is called in the async path too
[[ "${(pj:\0:)_p9k__battery_args}" == $prev ]] && return 1
_p9k_print_params _p9k__battery_args
echo -E - 'reset=2'
@ -1375,9 +1416,9 @@ _p9k_prompt_battery_set_args() {
case $_p9k_os in
OSX)
(( $+commands[pmset] )) || return
(( $+commands[pmset] )) || return 1 # return non-zero for failure
local raw_data=${${(Af)"$(pmset -g batt 2>/dev/null)"}[2]}
[[ $raw_data == *InternalBattery* ]] || return
[[ $raw_data == *InternalBattery* ]] || return 1
remain=${${(s: :)${${(s:; :)raw_data}[3]}}[1]}
[[ $remain == *no* ]] && remain="..."
[[ $raw_data =~ '([0-9]+)%' ]] && bat_percent=$match[1]
@ -1401,44 +1442,151 @@ _p9k_prompt_battery_set_args() {
esac
;;
Linux|Android)
# See https://sourceforge.net/projects/acpiclient.
local -a bats=( /sys/class/power_supply/(CMB*|BAT*|*battery)/(FN) )
(( $#bats )) || return
Android)
if (( $+commands[termux-battery-status] )); then
local battery_info
battery_info=$(termux-battery-status 2>/dev/null)
local -i energy_now energy_full power_now
local -i is_full=1 is_calculating is_charching
local dir
for dir in $bats; do
_p9k_read_file $dir/status(N) && local bat_status=$_p9k__ret || continue
# Skip batteries with "Unknown" status: https://github.com/romkatv/powerlevel10k/pull/2562.
[[ $bat_status == Unknown ]] && continue
local -i pow=0 full=0
if _p9k_read_file $dir/(energy_full|charge_full|charge_counter)(N); then
(( energy_full += ${full::=_p9k__ret} ))
if [[ -z "$battery_info" ]]; then
return 1 # Command failed or returned empty
fi
if _p9k_read_file $dir/(power|current)_now(N) && (( $#_p9k__ret < 9 )); then
(( power_now += ${pow::=$_p9k__ret} ))
# Extract percentage (integer) - using command to avoid aliases
bat_percent_str=$(echo "$battery_info" | command grep '"percentage":' | command sed 's/.*"percentage": *\([0-9]*\).*/\1/')
# Extract status (string, e.g., "CHARGING", "DISCHARGING", "FULL")
termux_status_str=$(echo "$battery_info" | command grep '"status":' | command sed 's/.*"status": *"\([^"]*\)".*/\1/')
if ! [[ "$bat_percent_str" =~ ^[0-9]+$ ]]; then
return 1 # Failed to parse percentage
fi
if _p9k_read_file $dir/capacity(N); then
(( energy_now += _p9k__ret * full / 100. + 0.5 ))
elif _p9k_read_file $dir/(energy|charge)_now(N); then
(( energy_now += _p9k__ret ))
fi
[[ $bat_status != Full ]] && is_full=0
[[ $bat_status == Charging ]] && is_charching=1
[[ $bat_status == (Charging|Discharging) && $pow == 0 ]] && is_calculating=1
done
bat_percent=$((bat_percent_str))
(( energy_full )) || return
# termux-battery-status does not provide remaining time estimate directly
remain="" # Set to "" or "..." if a placeholder is desired
bat_percent=$(( 100. * energy_now / energy_full + 0.5 ))
(( bat_percent > 100 )) && bat_percent=100
if (( is_full || (bat_percent == 100 && is_charching) )); then
case "$termux_status_str" in
"FULL")
state=CHARGED
;;
"CHARGING")
if (( bat_percent == 100 )); then
state=CHARGED
else
if (( is_charching )); then
state=CHARGING
fi
;;
"DISCHARGING")
if (( bat_percent < _POWERLEVEL9K_BATTERY_LOW_THRESHOLD )); then
state=LOW
else
state=DISCONNECTED
fi
;;
"NOT_CHARGING")
if (( bat_percent < _POWERLEVEL9K_BATTERY_LOW_THRESHOLD )); then
state=LOW
else
state=DISCONNECTED
fi
;;
"UNKNOWN")
# If status is UNKNOWN, but we have a percentage.
if (( bat_percent < _POWERLEVEL9K_BATTERY_LOW_THRESHOLD )); then
state=LOW
else
state=DISCONNECTED # Fallback for UNKNOWN if not low
fi
;;
*) # Empty or unexpected status
if [[ -n "$bat_percent_str" ]]; then # Check if we at least have percentage
if (( bat_percent < _POWERLEVEL9K_BATTERY_LOW_THRESHOLD )); then
state=LOW
else
state=DISCONNECTED
fi
else
return 1 # No useful info
fi
;;
esac
else
# termux-battery-status command not found
return 1
fi
;;
Linux)
# Original Linux logic using /sys/class/power_supply
local -a bats=( /sys/class/power_supply/(CMB*|BAT*|*battery)(N) ) # N/ ensures we only get directories
(( $#bats )) || return 1
local -i energy_now=0 energy_full=0 power_now=0 # Initialize to 0
local -i is_full=1 is_calculating=0 is_charging=0 # Corrected spelling and sensible defaults
local dir bat_status_raw
local -i one_bat_found=0 # Flag to check if at least one valid battery is processed
for dir in $bats; do
# _p9k_read_file is a P9k internal helper; ensure it's available or use `cat`
# Assuming _p9k_read_file sets _p9k__ret and returns 0 on success.
if _p9k_read_file $dir/status(N) && [[ -n "$_p9k__ret" ]]; then
bat_status_raw="$_p9k__ret"
else
continue # Skip if status cannot be read
fi
[[ $bat_status_raw == Unknown ]] && continue
one_bat_found=1 # At least one battery with a known status
local -i current_energy_full=0 current_power_now=0 current_energy_now=0
if _p9k_read_file $dir/(energy_full|charge_full|charge_counter)(N) && [[ -n "$_p9k__ret" ]]; then
current_energy_full=$_p9k__ret
(( energy_full += current_energy_full ))
fi
if _p9k_read_file $dir/(power_now|current_now)(N) && [[ -n "$_p9k__ret" ]] && (( $#_p9k__ret < 9 )); then # current_now can be large, power_now usually smaller
current_power_now=$_p9k__ret
(( power_now += current_power_now ))
fi
if _p9k_read_file $dir/capacity(N) && [[ -n "$_p9k__ret" ]] && (( current_energy_full > 0 )); then
# Calculate energy_now from capacity and energy_full of *this* battery
(( current_energy_now = (_p9k__ret * current_energy_full) / 100 ))
(( energy_now += current_energy_now ))
elif _p9k_read_file $dir/(energy_now|charge_now)(N) && [[ -n "$_p9k__ret" ]]; then
current_energy_now=$_p9k__ret
(( energy_now += current_energy_now ))
fi
[[ $bat_status_raw != Full ]] && is_full=0
[[ $bat_status_raw == Charging ]] && is_charging=1
# is_calculating: if charging or discharging but power_now for this battery is 0
[[ ($bat_status_raw == Charging || $bat_status_raw == Discharging) && $current_power_now == 0 ]] && is_calculating=1
done
(( one_bat_found )) || return 1 # No valid battery processed
(( energy_full > 0 )) || return 1 # Cannot calculate percentage
# Ensure energy_now does not exceed energy_full
(( energy_now > energy_full )) && energy_now=$energy_full
bat_percent=$(( (100 * energy_now) / energy_full )) # Integer arithmetic is fine for percentage
# bat_percent=$(( 100. * energy_now / energy_full + 0.5 )) # Original used floating point then cast
# Using integer arithmetic for simplicity unless precision is critical and handled by caller.
# P9k often uses integer math. Let's try to stick to it or be explicit.
# For integer percentage:
if (( energy_full > 0 )); then
bat_percent=$(( (energy_now * 100) / energy_full ))
else
bat_percent=0 # Or handle error
fi
(( bat_percent > 100 )) && bat_percent=100
if (( is_full || (bat_percent == 100 && is_charging) )); then
state=CHARGED
remain=''
else
if (( is_charging )); then
state=CHARGING
elif (( bat_percent < _POWERLEVEL9K_BATTERY_LOW_THRESHOLD )); then
state=LOW
@ -1446,10 +1594,20 @@ _p9k_prompt_battery_set_args() {
state=DISCONNECTED
fi
# Calculate remaining time
remain=""
if (( power_now > 0 )); then
(( is_charching )) && local -i e=$((energy_full - energy_now)) || local -i e=energy_now
local -i minutes=$(( 60 * e / power_now ))
local -i e_for_time_calc=0
if (( is_charging )); then
(( e_for_time_calc = energy_full - energy_now ))
else
e_for_time_calc=$energy_now
fi
if (( e_for_time_calc > 0 )); then
local -i minutes=$(( (60 * e_for_time_calc) / power_now ))
(( minutes > 0 )) && remain=$((minutes/60)):${(l#2##0#)$((minutes%60))}
fi
elif (( is_calculating )); then
remain="..."
fi
@ -1457,11 +1615,15 @@ _p9k_prompt_battery_set_args() {
;;
*)
return 0
return 1 # Or 0 if it means "not applicable, success"
# Returning 1 to signify that args were not set for an unsupported OS.
;;
esac
(( bat_percent >= _POWERLEVEL9K_BATTERY_${state}_HIDE_ABOVE_THRESHOLD )) && return
# If state is not set (e.g. due to an issue in logic above), we should not proceed.
[[ -z "$state" ]] && return 1
(( bat_percent >= _POWERLEVEL9K_BATTERY_${state}_HIDE_ABOVE_THRESHOLD )) && return 0 # Successfully decided to hide
local msg="$bat_percent%%"
[[ $_POWERLEVEL9K_BATTERY_VERBOSE == 1 && -n $remain ]] && msg+=" ($remain)"
@ -1471,28 +1633,47 @@ _p9k_prompt_battery_set_args() {
local -i idx="${#${(@P)var}}"
if (( idx )); then
(( bat_percent < 100 )) && idx=$((bat_percent * idx / 100 + 1))
(( idx > ${#${(@P)var}} )) && idx=${#${(@P)var}} # Ensure idx is within bounds
icon=$'\1'"${${(@P)var}[idx]}"
fi
local bg=$_p9k_color1
local var=_POWERLEVEL9K_BATTERY_${state}_LEVEL_BACKGROUND
local -i idx="${#${(@P)var}}"
if (( idx )); then
(( bat_percent < 100 )) && idx=$((bat_percent * idx / 100 + 1))
bg="${${(@P)var}[idx]}"
local var_bg=_POWERLEVEL9K_BATTERY_${state}_LEVEL_BACKGROUND
local -i idx_bg="${#${(@P)var_bg}}"
if (( idx_bg )); then
(( bat_percent < 100 )) && idx_bg=$((bat_percent * idx_bg / 100 + 1))
(( idx_bg > ${#${(@P)var_bg}} )) && idx_bg=${#${(@P)var_bg}}
bg="${${(@P)var_bg}[idx_bg]}"
fi
local fg=$_p9k_battery_states[$state]
local var=_POWERLEVEL9K_BATTERY_${state}_LEVEL_FOREGROUND
local -i idx="${#${(@P)var}}"
if (( idx )); then
(( bat_percent < 100 )) && idx=$((bat_percent * idx / 100 + 1))
fg="${${(@P)var}[idx]}"
local var_fg=_POWERLEVEL9K_BATTERY_${state}_LEVEL_FOREGROUND
local -i idx_fg="${#${(@P)var_fg}}"
if (( idx_fg )); then
(( bat_percent < 100 )) && idx_fg=$((bat_percent * idx_fg / 100 + 1))
(( idx_fg > ${#${(@P)var_fg}} )) && idx_fg=${#${(@P)var_fg}}
fg="${${(@P)var_fg}[idx_fg]}"
fi
_p9k__battery_args=(prompt_battery_$state "$bg" "$fg" $icon 0 '' $msg)
return 0 # Successfully set args
}
# Ensure _POWERLEVEL9K_BATTERY_LOW_THRESHOLD is defined, e.g.:
# : ${_POWERLEVEL9K_BATTERY_LOW_THRESHOLD:=20}
# Ensure _POWERLEVEL9K_BATTERY_*_HIDE_ABOVE_THRESHOLD are defined, e.g.:
# : ${_POWERLEVEL9K_BATTERY_CHARGED_HIDE_ABOVE_THRESHOLD:=101} # Effectively never hide if charged
# : ${_POWERLEVEL9K_BATTERY_CHARGING_HIDE_ABOVE_THRESHOLD:=101}
# : ${_POWERLEVEL9K_BATTERY_DISCONNECTED_HIDE_ABOVE_THRESHOLD:=101}
# : ${_POWERLEVEL9K_BATTERY_LOW_HIDE_ABOVE_THRESHOLD:=101}
# Ensure _p9k_battery_states is defined (associative array)
# typeset -gA _p9k_battery_states
# _p9k_battery_states[CHARGED]='green'
# _p9k_battery_states[CHARGING]='yellow'
# _p9k_battery_states[DISCONNECTED]='blue'
# _p9k_battery_states[LOW]='red'
# (These would be part of P9k's broader configuration)
################################################################
# Public IP segment
prompt_public_ip() {
@ -1796,7 +1977,7 @@ prompt_dir() {
if (( $+_POWERLEVEL9K_SHORTEN_DELIMITER )); then
local delim=$_POWERLEVEL9K_SHORTEN_DELIMITER
else
if [[ $langinfo[CODESET] == (utf|UTF)(-|)8 ]]; then
if _p9k_codeset_is_utf8; then
local delim=$'\u2026'
else
local delim='..'
@ -4922,10 +5103,6 @@ function _p9k_fetch_nordvpn_status() {
# POWERLEVEL9K_NORDVPN_CONNECTING_CONTENT_EXPANSION='${P9K_NORDVPN_COUNTRY_CODE}'
# POWERLEVEL9K_NORDVPN_CONNECTING_BACKGROUND=cyan
function prompt_nordvpn() {
# This prompt segment is broken. See https://github.com/romkatv/powerlevel10k/issues/2860.
# It is disabled until it is fixed.
return
unset $__p9k_nordvpn_tag P9K_NORDVPN_COUNTRY_CODE
[[ -e /run/nordvpn/nordvpnd.sock ]] || return
_p9k_fetch_nordvpn_status 2>/dev/null || return
@ -6851,13 +7028,13 @@ function _p9k_restore_special_params() {
}
function _p9k_on_expand() {
(( _p9k__expanded && ! ${+__p9k_instant_prompt_active} )) && [[ "${langinfo[CODESET]}" == (utf|UTF)(-|)8 ]] && return
(( _p9k__expanded && ! ${+__p9k_instant_prompt_active} )) && _p9k_codeset_is_utf8 && return
eval "$__p9k_intro_no_locale"
if [[ $langinfo[CODESET] != (utf|UTF)(-|)8 ]]; then
if ! _p9k_codeset_is_utf8; then
_p9k_restore_special_params
if [[ $langinfo[CODESET] != (utf|UTF)(-|)8 ]] && _p9k_init_locale; then
if ! _p9k_codeset_is_utf8 && _p9k_init_locale; then
if [[ -n $LC_ALL ]]; then
_p9k__real_lc_all=$LC_ALL
LC_ALL=$__p9k_locale
@ -7458,7 +7635,7 @@ _p9k_init_params() {
_p9k_declare -i POWERLEVEL9K_VCS_SHORTEN_LENGTH
_p9k_declare -i POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH
_p9k_declare -s POWERLEVEL9K_VCS_SHORTEN_STRATEGY
if [[ $langinfo[CODESET] == (utf|UTF)(-|)8 ]]; then
if _p9k_codeset_is_utf8; then
_p9k_declare -e POWERLEVEL9K_VCS_SHORTEN_DELIMITER '\u2026'
else
_p9k_declare -e POWERLEVEL9K_VCS_SHORTEN_DELIMITER '..'
@ -8399,14 +8576,16 @@ _p9k_init_prompt() {
if (( _POWERLEVEL9K_TERM_SHELL_INTEGRATION )); then
_p9k_prompt_prefix_left+=$'%{\e]133;A\a%}'
_p9k_prompt_suffix_left+=$'%{\e]133;B\a%}'
if [[ $TERM_PROGRAM == WarpTerminal ]]; then
if [[ $TERM_PROGRAM == WarpTerminal ||
( $TERM_PROGRAM == iTerm.app && $TERM_PROGRAM_VERSION == (3.<7->*|<4->.*) ) ]]; then
_p9k_prompt_prefix_right=$'%{\e]133;P;k=r\a%}'$_p9k_prompt_prefix_right
_p9k_prompt_suffix_right+=$'%{\e]133;B\a%}'
fi
if (( $+_z4h_iterm_cmd && _z4h_can_save_restore_screen == 1 )); then
_p9k_prompt_prefix_left+=$'%{\ePtmux;\e\e]133;A\a\e\\%}'
_p9k_prompt_suffix_left+=$'%{\ePtmux;\e\e]133;B\a\e\\%}'
if [[ $TERM_PROGRAM == WarpTerminal ]]; then
if [[ $TERM_PROGRAM == WarpTerminal ||
( $TERM_PROGRAM == iTerm.app && $TERM_PROGRAM_VERSION == (3.<7->*|<4->.*) ) ]]; then
_p9k_prompt_prefix_right=$'%{\ePtmux;\e\e]133;P;k=r\a\e\\%}'$_p9k_prompt_prefix_right
_p9k_prompt_suffix_right+=$'%{\ePtmux;\e\e]133;B\a\e\\%}'
fi
@ -8965,6 +9144,11 @@ _p9k_init() {
function iterm2_decorate_prompt() {
typeset -g ITERM2_PRECMD_PS1=$PROMPT
typeset -g ITERM2_SHOULD_DECORATE_PROMPT=
if [[ -n $PS2 && $PS2 != *$'\e]133;A;k=s\a'* && -z ${ITERM2_SQUELCH_PS2_MARK-} &&
$TERM_PROGRAM_VERSION == (3.<7->*|<4->.*) ]]; then
typeset -g ITERM2_PRECMD_PS2=$PS2
PS2=$'%{\e]133;A;k=s\a%}'$PS2$'%{\e]133;B\a%}'
fi
}
fi
if (( $+functions[iterm2_precmd] )); then
@ -9512,7 +9696,7 @@ if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file && -n $__p9k_instant_p
zf_rm -f -- $__p9k_instant_prompt_dump_file{,.zwc} 2>/dev/null
fi
typeset -g P9K_VERSION=1.20.15
typeset -g P9K_VERSION=1.20.17
if [[ ${VSCODE_SHELL_INTEGRATION-} == <1-> && ${+__p9k_force_term_shell_integration} == 0 ]]; then
typeset -gri __p9k_force_term_shell_integration=1

View File

@ -27,7 +27,13 @@
local -a match mbegin mend
local -i MBEGIN MEND OPTIND
local MATCH OPTARG IFS=$'\'' \t\n\0'\'
typeset -gr __p9k_intro_locale='[[ $langinfo[CODESET] != (utf|UTF)(-|)8 ]] && _p9k_init_locale && { [[ -n $LC_ALL ]] && local LC_ALL=$__p9k_locale || local LC_CTYPE=$__p9k_locale }'
# Use `case` to survive SH_GLOB.
typeset -gr __p9k_intro_locale='{
case "${langinfo[CODESET]}" in
utf-8|UTF-8|utf8|UTF8) false;;
*) true;;
esac
} && _p9k_init_locale && { [[ -n "$LC_ALL" ]] && local LC_ALL=$__p9k_locale || local LC_CTYPE=$__p9k_locale }'
typeset -gr __p9k_intro_no_locale="${${__p9k_intro_base/ match / match reply }/ MATCH / MATCH REPLY }"
typeset -gr __p9k_intro_no_reply="$__p9k_intro_base; $__p9k_intro_locale"
typeset -gr __p9k_intro="$__p9k_intro_no_locale; $__p9k_intro_locale"