gitk: Switch to patch mode when searching for line origin

If the "Show origin of this line" is started from tree mode, it still shows the result in tree mode, which I suppose not what user expects to see. Signed-off-by: Paul Mackerras <paulus@samba.org>

Max Kirillov committed Apr 5, 2014 at 23:38 UTC 4135d36b0c99329eff69686f7a17406053941b5c
1 file changed +6 -2
gitk
+6 -2
@@ -3871,7 +3871,7 @@ proc read_line_source {fd inst} {
3871 set id $nullid2
3872 }
3873 if {[commitinview $id $curview]} {
3874 - selectline [rowofcommit $id] 1 [list $fname $lnum]
3874 + selectline [rowofcommit $id] 1 [list $fname $lnum] 1
3875 } else {
3876 error_popup [mc "That line comes from commit %s, \
3877 which is not in this view" [shortids $id]]
@@ -7162,7 +7162,7 @@ proc make_idmark {id} {
7162 $canv raise $t
7163 }
7164
7165 -proc selectline {l isnew {desired_loc {}}} {
7165 +proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
7166 global canv ctext commitinfo selectedline
7167 global canvy0 linespc parents children curview
7168 global currentid sha1entry
@@ -7188,6 +7188,10 @@ proc selectline {l isnew {desired_loc {}}} {
7188 setcanvscroll
7189 }
7190
7191 + if {$cmitmode ne "patch" && $switch_to_patch} {
7192 + set cmitmode "patch"
7193 + }
7194 +
7195 set y [expr {$canvy0 + $l * $linespc}]
7196 set ymax [lindex [$canv cget -scrollregion] 3]
7197 set ytop [expr {$y - $linespc - 1}]