foxshell/fn/-z4h-zle-line-init
2025-07-04 11:48:40 -05:00

39 lines
1 KiB
Bash

#!/usr/bin/env zsh
local -i ret
if [[ ${CONTEXT-} != start || -v _z4h_transient_rprompt ]]; then
if [[ ${CONTEXT} == start ]]; then
unsetopt transient_rprompt
unset _z4h_transient_rprompt
elif [[ ! -o transient_rprompt ]]; then
setopt transient_rprompt
typeset -g _z4h_transient_rprompt=
fi
fi
if (( ${+widgets[-z4h-orig-zle-line-init]} )); then
zle -- -z4h-orig-zle-line-init "$@" || ret=$?
fi
if (( ${+_z4h_redraw_fd} )); then
zle -F "$_z4h_redraw_fd"
exec {_z4h_redraw_fd}>&-
unset _z4h_redraw_fd
fi
unset POSTDISPLAY _z4h_autosuggest_buffer _z4h_autosuggestion _zsh_highlight__highlighter_${^ZSH_HIGHLIGHT_HIGHLIGHTERS}_cache
typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER=
typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=CURSOR
region_highlight=()
if [[ ${(%):-%~} != ${_z4h_last_dir-} && ! -v _z4h_dir_hist_fd ]]; then
typeset -gi _z4h_dir_hist_fd
if sysopen -o cloexec -ru _z4h_dir_hist_fd /dev/null; then
zle -F $_z4h_dir_hist_fd -z4h-update-dir-history
else
unset _z4h_dir_hist_fd
fi
fi
return ret