Use dialog(1) to obtain maximum-size; stty fails when running in a pipe-

chain. This allows dialogs to reach full size even when executed as an
rvalue operand to a pipe (e.g., cat file | bsdconfig -f-).
This commit is contained in:
Devin Teske 2013-11-07 10:30:20 +00:00
parent bdf4b1764e
commit 91d20ba0f7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=257785

View file

@ -301,7 +301,16 @@ f_dialog_max_size()
if [ "$USE_XDIALOG" ]; then
__max_size="$XDIALOG_MAXSIZE" # see CONFIGURATION
else
__max_size=$( stty size 2> /dev/null ) # usually "24 80"
if __max_size=$( $DIALOG --print-maxsize \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD )
then
# usually "MaxSize: 24, 80"
__max_size="${__max_size#*: }"
f_replaceall "$__max_size" "," "" __max_size
else
__max_size=$( stty size 2> /dev/null )
# usually "24 80"
fi
: ${__max_size:=$DEFAULT_TERMINAL_SIZE}
fi
if [ "$__var_height" ]; then