@@ -2248,9 +2248,8 @@ proc do_git_gui {} {
22482248 }
22492249}
22502250
2251- proc do_explore {} {
2252- global _gitworktree
2253- set explorer {}
2251+ # Get the system-specific explorer app/command.
2252+ proc get_explorer {} {
22542253 if {[ is_Cygwin] || [ is_Windows] } {
22552254 set explorer " explorer.exe"
22562255 } elseif {[ is_MacOSX] } {
@@ -2259,9 +2258,23 @@ proc do_explore {} {
22592258 # freedesktop.org-conforming system is our best shot
22602259 set explorer " xdg-open"
22612260 }
2261+ return $explorer
2262+ }
2263+
2264+ proc do_explore {} {
2265+ global _gitworktree
2266+ set explorer [ get_explorer]
22622267 eval exec $explorer [ list [file nativename $_gitworktree ] ] &
22632268}
22642269
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+
22652278set is_quitting 0
22662279set ret_code 1
22672280
@@ -3513,9 +3526,11 @@ tlabel .vpane.lower.diff.header.file \
35133526 -justify left
35143527tlabel .vpane.lower.diff.header.path \
35153528 -background gold \
3516- -foreground black \
3529+ -foreground blue \
35173530 -anchor w \
3518- -justify left
3531+ -justify left \
3532+ -font [ eval font create [font configure font_ui] -underline 1] \
3533+ -cursor hand2
35193534pack .vpane.lower.diff.header.status -side left
35203535pack .vpane.lower.diff.header.file -side left
35213536pack .vpane.lower.diff.header.path -fill x
@@ -3530,8 +3545,12 @@ $ctxm add command \
35303545 -type STRING \
35313546 -- $current_diff_path
35323547 }
3548+ $ctxm add command \
3549+ -label [ mc Open] \
3550+ -command {do_file_open $current_diff_path }
35333551lappend diff_actions [ list $ctxm entryconf [$ctxm index last] -state]
35343552bind_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 }
35353554
35363555# -- Diff Body
35373556#
0 commit comments