1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-11 10:04:19 +00:00

fix(purge): dynamically limit path display width to 70% of terminal, fixing issue #433

This commit is contained in:
tw93
2026-02-09 19:34:15 +08:00
parent f5cbbce0b2
commit f8ff6d54cd

View File

@@ -1010,9 +1010,10 @@ clean_project_artifacts() {
local terminal_width=$(tput cols 2> /dev/null || echo 80)
local fixed_width=32 # Reserve for size and artifact type (9 + 3 + 20)
local available_width=$((terminal_width - fixed_width))
# Bounds: 30-50 chars for project path (increased to accommodate full paths)
# Bounds: 30 chars min, but cap at 70% of terminal width to preserve aesthetics
local max_aesthetic_width=$((terminal_width * 70 / 100))
[[ $available_width -gt $max_aesthetic_width ]] && available_width=$max_aesthetic_width
[[ $available_width -lt 30 ]] && available_width=30
[[ $available_width -gt 50 ]] && available_width=50
# Truncate project path if needed
local truncated_path=$(truncate_by_display_width "$project_path" "$available_width")
local current_width=$(get_display_width "$truncated_path")