From: Pat Thoyts Date: Fri, 22 Mar 2002 00:01:44 +0000 (+0000) Subject: SF Bug #533164: Fixed the globals window to cope with empty arrays properly. X-Git-Tag: r5_1_6p7~4 X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=5fd697dabb0c9250b28bdb0d2809091252397a39;p=tkinspect SF Bug #533164: Fixed the globals window to cope with empty arrays properly. --- diff --git a/ChangeLog b/ChangeLog index 6b7cb44..ce16744 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ Thu Mar 21 15:27:53 2002 Pat Thoyts * tkinspect.tcl: Improved the dde send implementation and fixed the window title to show the application name. + * globals_list.tcl: Bug #533164: Fixed the retrieve for empty + arrays. Thu Mar 21 00:32:17 2002 Pat Thoyts diff --git a/globals_list.tcl b/globals_list.tcl index 05aca20..1dce346 100644 --- a/globals_list.tcl +++ b/globals_list.tcl @@ -126,15 +126,20 @@ widget globals_list { } } method retrieve {target var} { - if ![send $target [list array size $var]] { + if ![send $target [list array exists $var]] { return [list set $var [send $target [list set $var]]] } set result {} - foreach elt [lsort [send $target [list array names $var]]] { - append result [list set [set var]($elt) \ - [send $target [list set [set var]($elt)]]] - append result "\n" - } + set names [lsort [send $target [list array names $var]]] + if {[llength $names] == 0} { + append result "array set $var {}\n" + } else { + foreach elt $names { + append result [list set [set var]($elt) \ + [send $target [list set [set var]($elt)]]] + append result "\n" + } + } return $result } method send_filter {value} {