Skip to content

Commit 4135d36

Browse files
max630paulusmack
authored andcommitted
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 <[email protected]>
1 parent ada2ea1 commit 4135d36

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

gitk

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3871,7 +3871,7 @@ proc read_line_source {fd inst} {
38713871
set id $nullid2
38723872
}
38733873
if {[commitinview $id $curview]} {
3874-
selectline [rowofcommit $id] 1 [list $fname $lnum]
3874+
selectline [rowofcommit $id] 1 [list $fname $lnum] 1
38753875
} else {
38763876
error_popup [mc "That line comes from commit %s, \
38773877
which is not in this view" [shortids $id]]
@@ -7162,7 +7162,7 @@ proc make_idmark {id} {
71627162
$canv raise $t
71637163
}
71647164

7165-
proc selectline {l isnew {desired_loc {}}} {
7165+
proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
71667166
global canv ctext commitinfo selectedline
71677167
global canvy0 linespc parents children curview
71687168
global currentid sha1entry
@@ -7188,6 +7188,10 @@ proc selectline {l isnew {desired_loc {}}} {
71887188
setcanvscroll
71897189
}
71907190

7191+
if {$cmitmode ne "patch" && $switch_to_patch} {
7192+
set cmitmode "patch"
7193+
}
7194+
71917195
set y [expr {$canvy0 + $l * $linespc}]
71927196
set ymax [lindex [$canv cget -scrollregion] 3]
71937197
set ytop [expr {$y - $linespc - 1}]

0 commit comments

Comments
 (0)