@@ -715,7 +715,7 @@ proc bindline {t id} {
715
715
$canv bind $t <Enter> " lineenter %x %y $id "
716
716
$canv bind $t <Motion> " linemotion %x %y $id "
717
717
$canv bind $t <Leave> " lineleave $id "
718
- $canv bind $t <Button-1> " lineclick %x %y $id "
718
+ $canv bind $t <Button-1> " lineclick %x %y $id 1 "
719
719
}
720
720
721
721
proc drawcommitline {level} {
@@ -1687,7 +1687,7 @@ proc unmarkmatches {} {
1687
1687
}
1688
1688
1689
1689
proc selcanvline {w x y} {
1690
- global canv canvy0 ctext linespc selectedline
1690
+ global canv canvy0 ctext linespc
1691
1691
global lineid linehtag linentag linedtag rowtextx
1692
1692
set ymax [lindex [$canv cget -scrollregion] 3]
1693
1693
if {$ymax == {}} return
@@ -1710,7 +1710,6 @@ proc selectline {l isnew} {
1710
1710
global canvy0 linespc parents nparents
1711
1711
global cflist currentid sha1entry
1712
1712
global commentend idtags idline
1713
- global history historyindex
1714
1713
1715
1714
$canv delete hover
1716
1715
if {![info exists lineid($l )] || ![info exists linehtag($l )]} return
@@ -1761,19 +1760,8 @@ proc selectline {l isnew} {
1761
1760
allcanvs yview moveto [expr $newtop * 1.0 / $ymax ]
1762
1761
}
1763
1762
1764
- if {$isnew && (![info exists selectedline] || $selectedline != $l )} {
1765
- if {$historyindex < [llength $history ]} {
1766
- set history [lreplace $history $historyindex end $l ]
1767
- } else {
1768
- lappend history $l
1769
- }
1770
- incr historyindex
1771
- if {$historyindex > 1} {
1772
- .ctop.top.bar.leftbut conf -state normal
1773
- } else {
1774
- .ctop.top.bar.leftbut conf -state disabled
1775
- }
1776
- .ctop.top.bar.rightbut conf -state disabled
1763
+ if {$isnew } {
1764
+ addtohistory [list selectline $l 0]
1777
1765
}
1778
1766
1779
1767
set selectedline $l
@@ -1857,12 +1845,42 @@ proc selnextline {dir} {
1857
1845
selectline $l 1
1858
1846
}
1859
1847
1848
+ proc unselectline {} {
1849
+ global selectedline
1850
+
1851
+ catch {unset selectedline}
1852
+ allcanvs delete secsel
1853
+ }
1854
+
1855
+ proc addtohistory {cmd} {
1856
+ global history historyindex
1857
+
1858
+ if {$historyindex > 0
1859
+ && [lindex $history [expr {$historyindex - 1}]] == $cmd } {
1860
+ return
1861
+ }
1862
+
1863
+ if {$historyindex < [llength $history ]} {
1864
+ set history [lreplace $history $historyindex end $cmd ]
1865
+ } else {
1866
+ lappend history $cmd
1867
+ }
1868
+ incr historyindex
1869
+ if {$historyindex > 1} {
1870
+ .ctop.top.bar.leftbut conf -state normal
1871
+ } else {
1872
+ .ctop.top.bar.leftbut conf -state disabled
1873
+ }
1874
+ .ctop.top.bar.rightbut conf -state disabled
1875
+ }
1876
+
1860
1877
proc goback {} {
1861
1878
global history historyindex
1862
1879
1863
1880
if {$historyindex > 1} {
1864
1881
incr historyindex -1
1865
- selectline [lindex $history [expr {$historyindex - 1}]] 0
1882
+ set cmd [lindex $history [expr {$historyindex - 1}]]
1883
+ eval $cmd
1866
1884
.ctop.top.bar.rightbut conf -state normal
1867
1885
}
1868
1886
if {$historyindex <= 1} {
@@ -1874,9 +1892,9 @@ proc goforw {} {
1874
1892
global history historyindex
1875
1893
1876
1894
if {$historyindex < [llength $history ]} {
1877
- set l [lindex $history $historyindex ]
1895
+ set cmd [lindex $history $historyindex ]
1878
1896
incr historyindex
1879
- selectline $l 0
1897
+ eval $cmd
1880
1898
.ctop.top.bar.leftbut conf -state normal
1881
1899
}
1882
1900
if {$historyindex >= [llength $history ]} {
@@ -2624,7 +2642,7 @@ proc setcoords {} {
2624
2642
}
2625
2643
2626
2644
proc redisplay {} {
2627
- global selectedline stopped redisplaying phase
2645
+ global stopped redisplaying phase
2628
2646
if {$stopped > 1} return
2629
2647
if {$phase == " getcommits" } return
2630
2648
set redisplaying 1
@@ -2636,7 +2654,7 @@ proc redisplay {} {
2636
2654
}
2637
2655
2638
2656
proc incrfont {inc} {
2639
- global mainfont namefont textfont selectedline ctext canv phase
2657
+ global mainfont namefont textfont ctext canv phase
2640
2658
global stopped entries
2641
2659
unmarkmatches
2642
2660
set mainfont [lreplace $mainfont 1 1 [expr {[lindex $mainfont 1] + $inc }]]
@@ -2778,34 +2796,40 @@ proc linehover {} {
2778
2796
$canv raise $t
2779
2797
}
2780
2798
2781
- proc lineclick {x y id} {
2799
+ proc lineclick {x y id isnew } {
2782
2800
global ctext commitinfo children cflist canv
2783
2801
2784
2802
unmarkmatches
2803
+ unselectline
2804
+ if {$isnew } {
2805
+ addtohistory [list lineclick $x $x $id 0]
2806
+ }
2785
2807
$canv delete hover
2786
2808
# fill the details pane with info about this line
2787
2809
$ctext conf -state normal
2788
2810
$ctext delete 0.0 end
2789
- $ctext insert end " Parent:\n "
2790
- catch {destroy $ctext .$id }
2791
- button $ctext .$id -text " Go:" -command " selbyid $id " \
2792
- -padx 4 -pady 0
2793
- $ctext window create end -window $ctext .$id -align center
2811
+ $ctext tag conf link -foreground blue -underline 1
2812
+ $ctext tag bind link <Enter> { %W configure -cursor hand2 }
2813
+ $ctext tag bind link <Leave> { %W configure -cursor $curtextcursor }
2814
+ $ctext insert end " Parent:\t "
2815
+ $ctext insert end $id [list link link0]
2816
+ $ctext tag bind link0 <1> [list selbyid $id ]
2794
2817
set info $commitinfo($id)
2795
- $ctext insert end " \t [ lindex $info 0] \n "
2818
+ $ctext insert end " \n\ t [ lindex $info 0] \n "
2796
2819
$ctext insert end " \t Author:\t [ lindex $info 1] \n "
2797
2820
$ctext insert end " \t Date:\t [ lindex $info 2] \n "
2798
- $ctext insert end " \t ID:\t $id \n "
2799
2821
if {[info exists children($id )]} {
2800
2822
$ctext insert end " \n Children:"
2823
+ set i 0
2801
2824
foreach child $children($id) {
2802
- $ctext insert end " \n "
2803
- catch {destroy $ctext .$child }
2804
- button $ctext .$child -text " Go:" -command " selbyid $child " \
2805
- -padx 4 -pady 0
2806
- $ctext window create end -window $ctext .$child -align center
2825
+ incr i
2807
2826
set info $commitinfo($child)
2808
- $ctext insert end " \t [ lindex $info 0] "
2827
+ $ctext insert end " \n\t "
2828
+ $ctext insert end $child [list link link$i ]
2829
+ $ctext tag bind link$i <1> [list selbyid $child ]
2830
+ $ctext insert end " \n\t [ lindex $info 0] "
2831
+ $ctext insert end " \n\t Author:\t [ lindex $info 1] "
2832
+ $ctext insert end " \n\t Date:\t [ lindex $info 2] \n "
2809
2833
}
2810
2834
}
2811
2835
$ctext conf -state disabled
@@ -2845,8 +2869,6 @@ proc rowmenu {x y id} {
2845
2869
2846
2870
proc diffvssel {dirn} {
2847
2871
global rowmenuid selectedline lineid
2848
- global ctext cflist
2849
- global commitinfo
2850
2872
2851
2873
if {![info exists selectedline]} return
2852
2874
if {$dirn } {
@@ -2856,15 +2878,32 @@ proc diffvssel {dirn} {
2856
2878
set oldid $rowmenuid
2857
2879
set newid $lineid($selectedline)
2858
2880
}
2881
+ addtohistory [list doseldiff $oldid $newid ]
2882
+ doseldiff $oldid $newid
2883
+ }
2884
+
2885
+ proc doseldiff {oldid newid} {
2886
+ global ctext cflist
2887
+ global commitinfo
2888
+
2859
2889
$ctext conf -state normal
2860
2890
$ctext delete 0.0 end
2861
2891
$ctext mark set fmark.0 0.0
2862
2892
$ctext mark gravity fmark.0 left
2863
2893
$cflist delete 0 end
2864
2894
$cflist insert end " Top"
2865
- $ctext insert end " From $oldid \n "
2895
+ $ctext insert end " From "
2896
+ $ctext tag conf link -foreground blue -underline 1
2897
+ $ctext tag bind link <Enter> { %W configure -cursor hand2 }
2898
+ $ctext tag bind link <Leave> { %W configure -cursor $curtextcursor }
2899
+ $ctext tag bind link0 <1> [list selbyid $oldid ]
2900
+ $ctext insert end $oldid [list link link0]
2901
+ $ctext insert end " \n "
2866
2902
$ctext insert end [lindex $commitinfo($oldid) 0]
2867
- $ctext insert end " \n\n To $newid \n "
2903
+ $ctext insert end " \n\n To "
2904
+ $ctext tag bind link1 <1> [list selbyid $newid ]
2905
+ $ctext insert end $newid [list link link1]
2906
+ $ctext insert end " \n "
2868
2907
$ctext insert end [lindex $commitinfo($newid) 0]
2869
2908
$ctext insert end " \n "
2870
2909
$ctext conf -state disabled
0 commit comments