@@ -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
@@ -1799,9 +1787,21 @@ proc selectline {l isnew} {
1799
1787
}
1800
1788
$ctext insert end " \n "
1801
1789
}
1802
- $ctext insert end " \n "
1790
+
1803
1791
set commentstart [$ctext index " end - 1c" ]
1804
- set comment [lindex $info 5]
1792
+ set comment {}
1793
+ foreach p $parents($id) {
1794
+ set l " ..."
1795
+ if {[info exists commitinfo($p )]} {
1796
+ set l [lindex $commitinfo($p) 0]
1797
+ if {[string length $l ] > 32} {
1798
+ set l " [ string range $l 0 28] ..."
1799
+ }
1800
+ }
1801
+ append comment " Parent: $p ($l )\n "
1802
+ }
1803
+ append comment " \n "
1804
+ append comment [lindex $info 5]
1805
1805
$ctext insert end $comment
1806
1806
$ctext insert end " \n "
1807
1807
@@ -1845,12 +1845,42 @@ proc selnextline {dir} {
1845
1845
selectline $l 1
1846
1846
}
1847
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
+
1848
1877
proc goback {} {
1849
1878
global history historyindex
1850
1879
1851
1880
if {$historyindex > 1} {
1852
1881
incr historyindex -1
1853
- selectline [lindex $history [expr {$historyindex - 1}]] 0
1882
+ set cmd [lindex $history [expr {$historyindex - 1}]]
1883
+ eval $cmd
1854
1884
.ctop.top.bar.rightbut conf -state normal
1855
1885
}
1856
1886
if {$historyindex <= 1} {
@@ -1862,9 +1892,9 @@ proc goforw {} {
1862
1892
global history historyindex
1863
1893
1864
1894
if {$historyindex < [llength $history ]} {
1865
- set l [lindex $history $historyindex ]
1895
+ set cmd [lindex $history $historyindex ]
1866
1896
incr historyindex
1867
- selectline $l 0
1897
+ eval $cmd
1868
1898
.ctop.top.bar.leftbut conf -state normal
1869
1899
}
1870
1900
if {$historyindex >= [llength $history ]} {
@@ -2612,7 +2642,7 @@ proc setcoords {} {
2612
2642
}
2613
2643
2614
2644
proc redisplay {} {
2615
- global selectedline stopped redisplaying phase
2645
+ global stopped redisplaying phase
2616
2646
if {$stopped > 1} return
2617
2647
if {$phase == " getcommits" } return
2618
2648
set redisplaying 1
@@ -2624,7 +2654,7 @@ proc redisplay {} {
2624
2654
}
2625
2655
2626
2656
proc incrfont {inc} {
2627
- global mainfont namefont textfont selectedline ctext canv phase
2657
+ global mainfont namefont textfont ctext canv phase
2628
2658
global stopped entries
2629
2659
unmarkmatches
2630
2660
set mainfont [lreplace $mainfont 1 1 [expr {[lindex $mainfont 1] + $inc }]]
@@ -2766,34 +2796,40 @@ proc linehover {} {
2766
2796
$canv raise $t
2767
2797
}
2768
2798
2769
- proc lineclick {x y id} {
2799
+ proc lineclick {x y id isnew } {
2770
2800
global ctext commitinfo children cflist canv
2771
2801
2772
2802
unmarkmatches
2803
+ unselectline
2804
+ if {$isnew } {
2805
+ addtohistory [list lineclick $x $x $id 0]
2806
+ }
2773
2807
$canv delete hover
2774
2808
# fill the details pane with info about this line
2775
2809
$ctext conf -state normal
2776
2810
$ctext delete 0.0 end
2777
- $ctext insert end " Parent:\n "
2778
- catch {destroy $ctext .$id }
2779
- button $ctext .$id -text " Go:" -command " selbyid $id " \
2780
- -padx 4 -pady 0
2781
- $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 ]
2782
2817
set info $commitinfo($id)
2783
- $ctext insert end " \t [ lindex $info 0] \n "
2818
+ $ctext insert end " \n\ t [ lindex $info 0] \n "
2784
2819
$ctext insert end " \t Author:\t [ lindex $info 1] \n "
2785
2820
$ctext insert end " \t Date:\t [ lindex $info 2] \n "
2786
- $ctext insert end " \t ID:\t $id \n "
2787
2821
if {[info exists children($id )]} {
2788
2822
$ctext insert end " \n Children:"
2823
+ set i 0
2789
2824
foreach child $children($id) {
2790
- $ctext insert end " \n "
2791
- catch {destroy $ctext .$child }
2792
- button $ctext .$child -text " Go:" -command " selbyid $child " \
2793
- -padx 4 -pady 0
2794
- $ctext window create end -window $ctext .$child -align center
2825
+ incr i
2795
2826
set info $commitinfo($child)
2796
- $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 "
2797
2833
}
2798
2834
}
2799
2835
$ctext conf -state disabled
@@ -2833,8 +2869,6 @@ proc rowmenu {x y id} {
2833
2869
2834
2870
proc diffvssel {dirn} {
2835
2871
global rowmenuid selectedline lineid
2836
- global ctext cflist
2837
- global commitinfo
2838
2872
2839
2873
if {![info exists selectedline]} return
2840
2874
if {$dirn } {
@@ -2844,15 +2878,32 @@ proc diffvssel {dirn} {
2844
2878
set oldid $rowmenuid
2845
2879
set newid $lineid($selectedline)
2846
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
+
2847
2889
$ctext conf -state normal
2848
2890
$ctext delete 0.0 end
2849
2891
$ctext mark set fmark.0 0.0
2850
2892
$ctext mark gravity fmark.0 left
2851
2893
$cflist delete 0 end
2852
2894
$cflist insert end " Top"
2853
- $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 "
2854
2902
$ctext insert end [lindex $commitinfo($oldid) 0]
2855
- $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 "
2856
2907
$ctext insert end [lindex $commitinfo($newid) 0]
2857
2908
$ctext insert end " \n "
2858
2909
$ctext conf -state disabled
0 commit comments