Deleted Added
full compact
3c3
< # Copyright (c) 2006-2013 Devin Teske
---
> # Copyright (c) 2006-2014 Devin Teske
27c27
< # $FreeBSD: stable/9/usr.sbin/bsdconfig/share/dialog.subr 253169 2013-07-10 20:22:31Z dteske $
---
> # $FreeBSD: stable/9/usr.sbin/bsdconfig/share/dialog.subr 263791 2014-03-27 03:20:47Z dteske $
76a77,88
> # Exit codes for [X]dialog(1)
> #
> DIALOG_OK=${SUCCESS:-0}
> DIALOG_CANCEL=${FAILURE:-1}
> DIALOG_HELP=2
> DIALOG_ITEM_HELP=2
> DIALOG_EXTRA=3
> DIALOG_ITEM_HELP=4
> export DIALOG_ERROR=254 # sh(1) can't handle the default of `-1'
> DIALOG_ESC=255
>
> #
286a299
> local funcname=f_dialog_max_size
292c305,317
< __max_size=$( stty size 2> /dev/null ) # usually "24 80"
---
> if __max_size=$( $DIALOG --print-maxsize \
> 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD )
> then
> f_dprintf "$funcname: %s --print-maxsize = [%s]" \
> "$DIALOG" "$__max_size"
> # usually "MaxSize: 24, 80"
> __max_size="${__max_size#*: }"
> f_replaceall "$__max_size" "," "" __max_size
> else
> f_eval_catch -dk __max_size $funcname stty \
> 'stty size' || __max_size=
> # usually "24 80"
> fi
406,407c431,432
< f_quietly f_getvar "$__var_height"
< f_quietly f_getvar "$__var_width"
---
> [ "$__var_height" ] && f_quietly f_getvar "$__var_height"
> [ "$__var_width" ] && f_quietly f_getvar "$__var_width"
447c472,473
< local __height __width __rows
---
> local __height_menu_constrain __width_menu_constrain
> local __rows_menu_constrain
452c478
< if ! debug= f_getvar "$__cp" __$__arg; then
---
> if ! debug= f_getvar "$__cp" __${__arg}_menu_constrain; then
456c482
< elif ! eval f_isinteger \$__$__arg; then
---
> elif ! eval f_isinteger \$__${__arg}_menu_constrain; then
480c506
< if [ $__height -lt ${__min_height:-0} ]; then
---
> if [ $__height_menu_constrain -lt ${__min_height:-0} ]; then
482c508,510
< elif [ $__height -gt $__max_height_menu_constrain ]; then
---
> elif [ $__height_menu_constrain -gt \
> $__max_height_menu_constrain ]
> then
494c522
< if [ $__width -lt $__min_width ]; then
---
> if [ $__width_menu_constrain -lt $__min_width ]; then
496c524,526
< elif [ $__width -gt $__max_width_menu_constrain ]; then
---
> elif [ $__width_menu_constrain -gt \
> $__max_width_menu_constrain ]
> then
509c539,541
< local __max_rows=$(( $__max_height_menu_constrain - 8 ))
---
> local __max_rows_menu_constrain=$((
> $__max_height_menu_constrain - 7
> ))
512,513c544,546
< [ ${__prompt_len:-0} -gt 0 ] ||
< __max_rows=$(( $__max_rows + 1 ))
---
> [ ${__prompt_len:-0} -gt 0 ] || __max_rows_menu_constrain=$((
> $__max_rows_menu_constrain + 1
> ))
515c548
< if [ $__rows -lt $__min_rows ]; then
---
> if [ $__rows_menu_constrain -lt $__min_rows ]; then
517,518c550,552
< elif [ $__rows -gt $__max_rows ]; then
< setvar "$__var_rows" $__max_rows
---
> elif [ $__rows_menu_constrain -gt $__max_rows_menu_constrain ]
> then
> setvar "$__var_rows" $__max_rows_menu_constrain
523,526c557,560
< # Print final constrained values to debuggin
< f_quietly f_getvar "$__var_height"
< f_quietly f_getvar "$__var_width"
< f_quietly f_getvar "$__var_rows"
---
> # Print final constrained values to debugging
> [ "$__var_height" ] && f_quietly f_getvar "$__var_height"
> [ "$__var_width" ] && f_quietly f_getvar "$__var_width"
> [ "$__var_rows" ] && f_quietly f_getvar "$__var_rows"
1078c1112
< local __longest_tag=0 __longest_item=0 __rows=0
---
> local __longest_tag=0 __longest_item=0 __rows_rlist_size=0
1084c1118
< __rows=$(( $__rows + 1 ))
---
> __rows_rlist_size=$(( $__rows_rlist_size + 1 ))
1090c1124,1125
< [ "$USE_XDIALOG" ] && __rows=$(( $__rows + 1 ))
---
> [ "$USE_XDIALOG" ] &&
> __rows_rlist_size=$(( $__rows_rlist_size + 1 ))
1098c1133,1134
< $__height_rlist_size + $__rows + 7 ))
---
> $__height_rlist_size + $__rows_rlist_size + 7
> ))
1101c1137,1138
< $__height_rlist_size + $__rows + 4 ))
---
> $__height_rlist_size + $__rows_rlist_size + 4
> ))
1118c1155
< [ "$__var_rows" ] && setvar "$__var_rows" $__rows
---
> [ "$__var_rows" ] && setvar "$__var_rows" $__rows_rlist_size
1198c1235,1236
< local __longest_tag=0 __longest_item=0 __longest_help=0 __rows=0
---
> local __longest_tag=0 __longest_item=0 __longest_help=0
> local __rows_rlist_with_help_size=0
1205c1243,1245
< __rows=$(( $__rows + 1 ))
---
> __rows_rlist_with_help_size=$((
> $__rows_rlist_with_help_size + 1
> ))
1211c1251,1254
< [ "$USE_XDIALOG" ] && __rows=$(( $__rows + 1 ))
---
> [ "$USE_XDIALOG" ] &&
> __rows_rlist_with_help_size=$((
> $__rows_rlist_with_help_size + 1
> ))
1219c1262,1264
< $__height_rlist_with_help_size + $__rows + 7 ))
---
> $__height_rlist_with_help_size +
> $__rows_rlist_with_help_size + 7
> ))
1222c1267,1269
< $__height_rlist_with_help_size + $__rows + 4 ))
---
> $__height_rlist_with_help_size +
> $__rows_rlist_with_help_size + 4
> ))
1248c1295
< [ "$__var_rows" ] && setvar "$__var_rows" $__rows
---
> [ "$__var_rows" ] && setvar "$__var_rows" $__rows_rlist_with_help_size
2033a2081,2082
> local funcname=f_dialog_init
>
2034a2084
> USE_DIALOG=1
2078c2128
< [ "$USE_XDIALOG" ] && DIALOG=Xdialog
---
> [ "$USE_XDIALOG" ] && DIALOG=Xdialog USE_DIALOG=
2121c2171
< HOSTNAME=$(hostname)
---
> HOSTNAME=$( hostname )
2135c2185,2186
< if ! maxsize=$( LANG= LC_ALL= $DIALOG --print-maxsize 2>&1 )
---
> if ! f_eval_catch -dk maxsize $funcname "$DIALOG" \
> 'LANG= LC_ALL= %s --print-maxsize' "$DIALOG"