@@ -2359,6 +2359,9 @@ proc makewindow {} {
23592359 {mc " Create new branch" command mkbranch}
23602360 {mc " Cherry-pick this commit" command cherrypick}
23612361 {mc " Reset HEAD branch to here" command resethead}
2362+ {mc " Mark this commit" command markhere}
2363+ {mc " Return to mark" command gotomark}
2364+ {mc " Find descendant of this and mark" command find_common_desc}
23622365 }
23632366 $rowctxmenu configure -tearoff 0
23642367
@@ -4074,7 +4077,7 @@ proc ishighlighted {id} {
40744077}
40754078
40764079proc bolden {id font} {
4077- global canv linehtag currentid boldids need_redisplay
4080+ global canv linehtag currentid boldids need_redisplay markedid
40784081
40794082 # need_redisplay = 1 means the display is stale and about to be redrawn
40804083 if {$need_redisplay } return
@@ -4087,6 +4090,9 @@ proc bolden {id font} {
40874090 -fill [$canv cget -selectbackground]]
40884091 $canv lower $t
40894092 }
4093+ if {[info exists markedid] && $id eq $markedid } {
4094+ make_idmark $id
4095+ }
40904096}
40914097
40924098proc bolden_name {id font} {
@@ -5591,7 +5597,7 @@ proc drawcmittext {id row col} {
55915597 global cmitlisted commitinfo rowidlist parentlist
55925598 global rowtextx idpos idtags idheads idotherrefs
55935599 global linehtag linentag linedtag selectedline
5594- global canvxmax boldids boldnameids fgcolor
5600+ global canvxmax boldids boldnameids fgcolor markedid
55955601 global mainheadid nullid nullid2 circleitem circlecolors ctxbut
55965602
55975603 # listed is 0 for boundary, 1 for normal, 2 for negative, 3 for left, 4 for right
@@ -5673,6 +5679,9 @@ proc drawcmittext {id row col} {
56735679 if {$selectedline == $row } {
56745680 make_secsel $id
56755681 }
5682+ if {[info exists markedid] && $markedid eq $id } {
5683+ make_idmark $id
5684+ }
56765685 set xr [expr {$xt + [font measure $font $headline ]}]
56775686 if {$xr > $canvxmax } {
56785687 set canvxmax $xr
@@ -6614,6 +6623,16 @@ proc make_secsel {id} {
66146623 $canv3 lower $t
66156624}
66166625
6626+ proc make_idmark {id} {
6627+ global linehtag canv fgcolor
6628+
6629+ if {![info exists linehtag($id )]} return
6630+ $canv delete markid
6631+ set t [eval $canv create rect [$canv bbox $linehtag($id) ] \
6632+ -tags markid -outline $fgcolor ]
6633+ $canv raise $t
6634+ }
6635+
66176636proc selectline {l isnew {desired_loc {}}} {
66186637 global canv ctext commitinfo selectedline
66196638 global canvy0 linespc parents children curview
@@ -7999,7 +8018,7 @@ proc mstime {} {
79998018
80008019proc rowmenu {x y id} {
80018020 global rowctxmenu selectedline rowmenuid curview
8002- global nullid nullid2 fakerowmenu mainhead
8021+ global nullid nullid2 fakerowmenu mainhead markedid
80038022
80048023 stopfinding
80058024 set rowmenuid $id
@@ -8015,6 +8034,13 @@ proc rowmenu {x y id} {
80158034 } else {
80168035 $menu entryconfigure 7 -label [mc " Detached head: can't reset" $mainhead ] -state disabled
80178036 }
8037+ if {[info exists markedid] && $markedid ne $id } {
8038+ $menu entryconfigure 9 -state normal
8039+ $menu entryconfigure 10 -state normal
8040+ } else {
8041+ $menu entryconfigure 9 -state disabled
8042+ $menu entryconfigure 10 -state disabled
8043+ }
80188044 } else {
80198045 set menu $fakerowmenu
80208046 }
@@ -8024,6 +8050,59 @@ proc rowmenu {x y id} {
80248050 tk_popup $menu $x $y
80258051}
80268052
8053+ proc markhere {} {
8054+ global rowmenuid markedid canv
8055+
8056+ set markedid $rowmenuid
8057+ make_idmark $markedid
8058+ }
8059+
8060+ proc gotomark {} {
8061+ global markedid
8062+
8063+ if {[info exists markedid]} {
8064+ selbyid $markedid
8065+ }
8066+ }
8067+
8068+ proc replace_by_kids {l r} {
8069+ global curview children
8070+
8071+ set id [commitonrow $r ]
8072+ set l [lreplace $l 0 0]
8073+ foreach kid $children($curview,$id) {
8074+ lappend l [rowofcommit $kid ]
8075+ }
8076+ return [lsort -integer -decreasing -unique $l ]
8077+ }
8078+
8079+ proc find_common_desc {} {
8080+ global markedid rowmenuid curview children
8081+
8082+ if {![info exists markedid]} return
8083+ if {![commitinview $markedid $curview ] ||
8084+ ![commitinview $rowmenuid $curview ]} return
8085+ # set t1 [clock clicks -milliseconds]
8086+ set l1 [list [rowofcommit $markedid ]]
8087+ set l2 [list [rowofcommit $rowmenuid ]]
8088+ while 1 {
8089+ set r1 [lindex $l1 0]
8090+ set r2 [lindex $l2 0]
8091+ if {$r1 eq {} || $r2 eq {}} break
8092+ if {$r1 == $r2 } {
8093+ selectline $r1 1
8094+ break
8095+ }
8096+ if {$r1 > $r2 } {
8097+ set l1 [replace_by_kids $l1 $r1 ]
8098+ } else {
8099+ set l2 [replace_by_kids $l2 $r2 ]
8100+ }
8101+ }
8102+ # set t2 [clock clicks -milliseconds]
8103+ # puts "took [expr {$t2-$t1}]ms"
8104+ }
8105+
80278106proc diffvssel {dirn} {
80288107 global rowmenuid selectedline
80298108
@@ -8218,7 +8297,7 @@ proc domktag {} {
82188297}
82198298
82208299proc redrawtags {id} {
8221- global canv linehtag idpos currentid curview cmitlisted
8300+ global canv linehtag idpos currentid curview cmitlisted markedid
82228301 global canvxmax iddrawn circleitem mainheadid circlecolors
82238302
82248303 if {![commitinview $id $curview ]} return
@@ -8243,6 +8322,9 @@ proc redrawtags {id} {
82438322 if {[info exists currentid] && $currentid == $id } {
82448323 make_secsel $id
82458324 }
8325+ if {[info exists markedid] && $markedid eq $id } {
8326+ make_idmark $id
8327+ }
82468328}
82478329
82488330proc mktagcan {} {
@@ -10269,6 +10351,7 @@ proc setfg {c} {
1026910351 }
1027010352 allcanvs itemconf text -fill $c
1027110353 $canv itemconf circle -outline $c
10354+ $canv itemconf markid -outline $c
1027210355}
1027310356
1027410357proc prefscan {} {
0 commit comments