_gsu_menu()
{
- local header="${1:-root}"
- local items="$2"
+ local header=${1:-root} dflt_item=$2 items=$3
local geom
_get_geometry
geom=$result
- result="$(dialog --no-lines --no-items --menu \
- "$gsu_banner_txt ($header)" \
+ result="$(dialog --no-lines --no-items \
+ --default-item "$dflt_item" \
+ --menu "$gsu_banner_txt ($header)" \
$geom 16 $items 3>&1 1>&2 2>&3 3>&-)"
_set_dialog_ret $?
}
_browse()
{
- local header="$1" old_header
- local tree="$2" subtree="$3"
+ local header=$1 tree=$2
+ local -a subtree=($3)
+ local old_header dflt_item=${subtree[0]}
while :; do
- _gsu_menu "$header" "$subtree"
+ _gsu_menu "$header" "$dflt_item" "${subtree[*]}"
((ret < 0)) && return
+ dflt_item=$result
[[ -z "$result" ]] && return # menu was cancelled
if [[ "${result%/}" != "$result" ]]; then
old_header="$header"