diff --git a/bashrc b/bashrc index 5b9684b..c9fa5f8 100644 --- a/bashrc +++ b/bashrc @@ -125,52 +125,40 @@ function show_date() { export HISTCONTROL=ignoreboth:erasedups -# Function to draw a terminal-width divider line with timestamp +# Optimized divider function - reduced subshells and calculations function draw_prompt_divider() { - local width=${COLUMNS:-80} # Use terminal width, fallback to 80 - local timestamp=$(date '+%H:%M:%S') + local timestamp prefix_length line_length i + printf -v timestamp '%(%H:%M:%S)T' -1 # Faster than $(date) local prefix="$timestamp ā”œ" - local prefix_length=${#prefix} - local line_length=$((width - prefix_length)) + prefix_length=${#prefix} + line_length=$(( ${COLUMNS:-80} - prefix_length )) - # Print timestamp + junction + line to fill remaining width + # Print prefix then fill with box-drawing characters printf '%s' "$prefix" - printf '%.0s─' $(seq 1 $line_length) + for ((i=0; i