@@ -30,8 +30,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.}]
3030# #
3131# # Tcl/Tk sanity check
3232
33- if {[catch {package require Tcl 8.4 } err]
34- || [catch {package require Tk 8.4 } err]
33+ if {[catch {package require Tcl 8.6 } err]
34+ || [catch {package require Tk 8.6 } err]
3535} {
3636 catch {wm withdraw .}
3737 tk_messageBox \
@@ -684,6 +684,7 @@ proc load_current_branch {} {
684684 global current_branch is_detached
685685
686686 set fd [ open [gitdir HEAD] r]
687+ fconfigure $fd -translation binary -encoding utf-8
687688 if {[ gets $fd ref] < 1} {
688689 set ref {}
689690 }
@@ -1797,10 +1798,10 @@ proc ui_status {msg} {
17971798 }
17981799}
17991800
1800- proc ui_ready {{test {}} } {
1801+ proc ui_ready {} {
18011802 global main_status
18021803 if {[ info exists main_status] } {
1803- $main_status show [ mc " Ready." ] $test
1804+ $main_status show [ mc " Ready." ]
18041805 }
18051806}
18061807
@@ -2150,8 +2151,6 @@ proc incr_font_size {font {amt 1}} {
21502151##
21512152## ui commands
21522153
2153- set starting_gitk_msg [ mc " Starting gitk... please wait..." ]
2154-
21552154proc do_gitk {revs {is_submodule false}} {
21562155 global current_diff_path file_states current_diff_side ui_index
21572156 global _gitdir _gitworktree
@@ -2206,10 +2205,11 @@ proc do_gitk {revs {is_submodule false}} {
22062205 set env(GIT_WORK_TREE) $_gitworktree
22072206 cd $pwd
22082207
2209- ui_status $::starting_gitk_msg
2210- after 10000 {
2211- ui_ready $starting_gitk_msg
2212- }
2208+ set status_operation [ $::main_status \
2209+ start \
2210+ [mc " Starting %s... please wait..." " gitk" ] ]
2211+
2212+ after 3500 [ list $status_operation stop]
22132213 }
22142214}
22152215
@@ -2240,16 +2240,16 @@ proc do_git_gui {} {
22402240 set env(GIT_WORK_TREE) $_gitworktree
22412241 cd $pwd
22422242
2243- ui_status $::starting_gitk_msg
2244- after 10000 {
2245- ui_ready $starting_gitk_msg
2246- }
2243+ set status_operation [ $::main_status \
2244+ start \
2245+ [mc " Starting %s... please wait..." " git-gui" ] ]
2246+
2247+ after 3500 [ list $status_operation stop]
22472248 }
22482249}
22492250
2250- proc do_explore {} {
2251- global _gitworktree
2252- set explorer {}
2251+ # Get the system-specific explorer app/command.
2252+ proc get_explorer {} {
22532253 if {[ is_Cygwin] || [ is_Windows] } {
22542254 set explorer " explorer.exe"
22552255 } elseif {[ is_MacOSX] } {
@@ -2258,9 +2258,23 @@ proc do_explore {} {
22582258 # freedesktop.org-conforming system is our best shot
22592259 set explorer " xdg-open"
22602260 }
2261+ return $explorer
2262+ }
2263+
2264+ proc do_explore {} {
2265+ global _gitworktree
2266+ set explorer [ get_explorer]
22612267 eval exec $explorer [ list [file nativename $_gitworktree ] ] &
22622268}
22632269
2270+ # Open file relative to the working tree by the default associated app.
2271+ proc do_file_open {file} {
2272+ global _gitworktree
2273+ set explorer [ get_explorer]
2274+ set full_file_path [ file join $_gitworktree $file ]
2275+ exec $explorer [ file nativename $full_file_path ] &
2276+ }
2277+
22642278set is_quitting 0
22652279set ret_code 1
22662280
@@ -3512,9 +3526,11 @@ tlabel .vpane.lower.diff.header.file \
35123526 -justify left
35133527tlabel .vpane.lower.diff.header.path \
35143528 -background gold \
3515- -foreground black \
3529+ -foreground blue \
35163530 -anchor w \
3517- -justify left
3531+ -justify left \
3532+ -font [ eval font create [font configure font_ui] -underline 1] \
3533+ -cursor hand2
35183534pack .vpane.lower.diff.header.status -side left
35193535pack .vpane.lower.diff.header.file -side left
35203536pack .vpane.lower.diff.header.path -fill x
@@ -3529,8 +3545,12 @@ $ctxm add command \
35293545 -type STRING \
35303546 -- $current_diff_path
35313547 }
3548+ $ctxm add command \
3549+ -label [ mc Open] \
3550+ -command {do_file_open $current_diff_path }
35323551lappend diff_actions [ list $ctxm entryconf [$ctxm index last] -state]
35333552bind_button3 .vpane.lower.diff.header.path " tk_popup $ctxm %X %Y"
3553+ bind .vpane.lower.diff.header.path <Button-1> {do_file_open $current_diff_path }
35343554
35353555# -- Diff Body
35363556#
@@ -4159,6 +4179,9 @@ if {$picked && [is_config_true gui.autoexplore]} {
41594179 do_explore
41604180}
41614181
4182+ # Clear " Initializing..." status
4183+ after 500 {$main_status show " " }
4184+
41624185# Local variables:
41634186# mode: tcl
41644187# indent-tabs-mode: t
0 commit comments