mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-09-19 21:17:31 -07:00
fix(bash): respect PROMPT_COMMAND
as an array
This commit is contained in:
parent
e2626c8668
commit
0644c93a67
|
@ -36,7 +36,7 @@ function _omp_set_cursor_position() {
|
|||
|
||||
local COL
|
||||
local ROW
|
||||
IFS=';' read -sdR -p $'\E[6n' ROW COL
|
||||
IFS=';' read -rsdR -p $'\E[6n' ROW COL
|
||||
|
||||
stty "$oldstty"
|
||||
|
||||
|
@ -92,10 +92,10 @@ function _omp_print_secondary() {
|
|||
}
|
||||
|
||||
function _omp_hook() {
|
||||
_omp_status_cache=$? _omp_pipestatus_cache=(${PIPESTATUS[@]})
|
||||
_omp_status_cache=$? _omp_pipestatus_cache=("${PIPESTATUS[@]}")
|
||||
|
||||
if [[ ${#BP_PIPESTATUS[@]} -ge ${#_omp_pipestatus_cache[@]} ]]; then
|
||||
_omp_pipestatus_cache=(${BP_PIPESTATUS[@]})
|
||||
_omp_pipestatus_cache=("${BP_PIPESTATUS[@]}")
|
||||
fi
|
||||
|
||||
_omp_stack_count=$((${#DIRSTACK[@]} - 1))
|
||||
|
@ -120,6 +120,16 @@ function _omp_hook() {
|
|||
return $_omp_status_cache
|
||||
}
|
||||
|
||||
if [[ $TERM != linux ]] && ! [[ $PROMPT_COMMAND =~ _omp_hook ]]; then
|
||||
PROMPT_COMMAND="_omp_hook; $PROMPT_COMMAND"
|
||||
fi
|
||||
function _omp_install_hook() {
|
||||
[[ $TERM = linux ]] && return
|
||||
|
||||
local cmd
|
||||
for cmd in "${PROMPT_COMMAND[@]}"; do
|
||||
if [[ $cmd = "_omp_hook" ]]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
PROMPT_COMMAND=(_omp_hook "${PROMPT_COMMAND[@]}")
|
||||
}
|
||||
|
||||
_omp_install_hook
|
||||
|
|
Loading…
Reference in a new issue