Limit the max size of the build-dir fzf window

This commit is contained in:
Kenneth Benzie 2024-05-01 17:33:53 +01:00
parent 0efb635f02
commit ba9eba596f

View File

@ -87,10 +87,12 @@ EOF
elif [[ ${#local_build_dirs} -gt 1 ]]; then elif [[ ${#local_build_dirs} -gt 1 ]]; then
if command -v fzf &> /dev/null; then if command -v fzf &> /dev/null; then
# Use fzf to select a build directory # Use fzf to select a build directory
local max=$(( $( tput lines ) / 2 ))
local best=$(( ${#local_build_dirs} + 5 ))
local_build_dir=$( local_build_dir=$(
printf '%s\n' "${local_build_dir[@]}" $local_build_dirs | printf '%s\n' "${local_build_dir[@]}" $local_build_dirs |
fzf --layout=reverse --info=hidden --border=rounded \ fzf --layout=reverse --info=hidden --border=rounded \
--height=$(( ${#local_build_dirs} + 5 )) --height=$(( $best < $max ? $best : $max ))
) )
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
return 1 return 1