Skip to content

Commit

Permalink
gitk: Switch to patch mode when searching for line origin
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
max630 authored and paulusmack committed Jun 15, 2014
1 parent ada2ea1 commit 4135d36
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gitk
Original file line number Diff line number Diff line change
Expand Up @@ -3871,7 +3871,7 @@ proc read_line_source {fd inst} {
set id $nullid2
}
if {[commitinview $id $curview]} {
selectline [rowofcommit $id] 1 [list $fname $lnum]
selectline [rowofcommit $id] 1 [list $fname $lnum] 1
} else {
error_popup [mc "That line comes from commit %s, \
which is not in this view" [shortids $id]]
Expand Down Expand Up @@ -7162,7 +7162,7 @@ proc make_idmark {id} {
$canv raise $t
}

proc selectline {l isnew {desired_loc {}}} {
proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
global canv ctext commitinfo selectedline
global canvy0 linespc parents children curview
global currentid sha1entry
Expand All @@ -7188,6 +7188,10 @@ proc selectline {l isnew {desired_loc {}}} {
setcanvscroll
}

if {$cmitmode ne "patch" && $switch_to_patch} {
set cmitmode "patch"
}

set y [expr {$canvy0 + $l * $linespc}]
set ymax [lindex [$canv cget -scrollregion] 3]
set ytop [expr {$y - $linespc - 1}]
Expand Down

0 comments on commit 4135d36

Please sign in to comment.