--- ray/src/util/getfile3.6.tcl 1994/10/28 20:14:43 2.5 +++ ray/src/util/getfile3.6.tcl 1994/12/01 10:14:56 2.8 @@ -23,6 +23,7 @@ proc getfile args { # get filename interactively set dograb 0 set curdir . set curpat * + set curfile {} set transient 1 # Get options while {[llength $args]} { @@ -160,7 +161,7 @@ proc getfile args { # get filename interactively proc update_dir w { # Update working directory global curdir curpat - if {"$curpat" == ""} { + if {"$curpat" == {}} { set curpat * } if {"$curdir" == {}} {set curdir {~}} @@ -172,9 +173,15 @@ proc update_dir w { # Update working directory $w.de config -foreground $oldcol } set curdir [pwd] + set offset [expr [string length $curdir] - 32] + if {$offset > 0} { + $w.de view [expr $offset + \ + [string first / [string range $curdir $offset end]] \ + + 1] + } $w.fm.fl delete 0 end set ls ../ - foreach f [glob *] { + foreach f [glob -nocomplain *] { if [file isdirectory $f] { lappend ls $f/ } @@ -188,7 +195,7 @@ proc update_dir w { # Update working directory } -proc set_curfile {w {sp ""}} { # change current file selection +proc set_curfile {w {sp {}}} { # change current file selection global curdir curfile set f [$w.fm.fl get [$w.fm.fl curselection]] if [string match */ $f] { @@ -196,7 +203,7 @@ proc set_curfile {w {sp ""}} { # change current file update_dir $w } else { set curfile $f - if {"$sp" > ""} { + if {"$sp" != {}} { $sp $curdir/$curfile } } @@ -205,7 +212,7 @@ proc set_curfile {w {sp ""}} { # change current file proc chk_select w { # check if current selection is file set s [$w.fm.fl curselection] - if {"$s" > "" && [file isfile [$w.fm.fl get $s]]} { + if {"$s" != {} && [file isfile [$w.fm.fl get $s]]} { $w.vi configure -state normal } else { $w.vi configure -state disabled