Fix wrong took when open terminal for the first time

This commit is contained in:
François
2026-04-19 19:55:04 +02:00
parent 89fde0ad2e
commit 7a8bba1a73

View File

@@ -118,7 +118,11 @@ PROMPT_PAD="."
PROMPT_EXTRA_WIDTH=73 PROMPT_EXTRA_WIDTH=73
precmd() { precmd() {
if [ -z ${STARTCMD_TS+x} ]; then
STARTCMD_TS=$(date +%s%N)
fi
local prompt_ln="${#${${PWD}/${HOME}/~}}" # len of path where $HOME is susbtiued by ~ (and is counted as 1) local prompt_ln="${#${${PWD}/${HOME}/~}}" # len of path where $HOME is susbtiued by ~ (and is counted as 1)
if (($COLUMNS > PROMPT_EXTRA_WIDTH + prompt_ln)); then if (($COLUMNS > PROMPT_EXTRA_WIDTH + prompt_ln)); then
local exec_ts=$(($(date +%s%N) - STARTCMD_TS)) local exec_ts=$(($(date +%s%N) - STARTCMD_TS))
local seconds=$(echo "scale=9; $exec_ts / 1000000000" | bc) local seconds=$(echo "scale=9; $exec_ts / 1000000000" | bc)