refactor(bash): use default value for COLUMNS

relates to #5102
This commit is contained in:
Jan De Dobbeleer 2024-06-17 14:22:50 +02:00 committed by Jan De Dobbeleer
parent 33ac83551e
commit f817acf963

View file

@ -54,11 +54,6 @@ function _omp_hook() {
local omp_stack_count=$((${#DIRSTACK[@]} - 1)) local omp_stack_count=$((${#DIRSTACK[@]} - 1))
local omp_elapsed=-1 local omp_elapsed=-1
local no_exit_code="true" local no_exit_code="true"
local omp_columns=0
if [[ -n "$COLUMNS" ]]; then
omp_columns=$COLUMNS
fi
if [[ -n "$omp_start_time" ]]; then if [[ -n "$omp_start_time" ]]; then
local omp_now=$(::OMP:: get millis --shell=bash) local omp_now=$(::OMP:: get millis --shell=bash)
@ -70,7 +65,7 @@ function _omp_hook() {
set_poshcontext set_poshcontext
_set_posh_cursor_position _set_posh_cursor_position
PS1="$(::OMP:: print primary --config="$POSH_THEME" --shell=bash --shell-version="$BASH_VERSION" --status="$ret" --pipestatus="${pipeStatus[*]}" --execution-time="$omp_elapsed" --stack-count="$omp_stack_count" --no-status="$no_exit_code" --terminal-width="$omp_columns" | tr -d '\0')" PS1="$(::OMP:: print primary --config="$POSH_THEME" --shell=bash --shell-version="$BASH_VERSION" --status="$ret" --pipestatus="${pipeStatus[*]}" --execution-time="$omp_elapsed" --stack-count="$omp_stack_count" --no-status="$no_exit_code" --terminal-width="${COLUMNS-0}" | tr -d '\0')"
return $ret return $ret
} }