@@ -1861,7 +1861,7 @@ proc gettreediffline {gdtf ids} {
1861
1861
1862
1862
proc getblobdiffs {ids} {
1863
1863
global diffopts blobdifffd diffids env curdifftag curtagstart
1864
- global diffindex difffilestart nextupdate diffinhdr
1864
+ global difffilestart nextupdate diffinhdr treediffs
1865
1865
1866
1866
set id [lindex $ids 0]
1867
1867
set p [lindex $ids 1]
@@ -1876,16 +1876,15 @@ proc getblobdiffs {ids} {
1876
1876
set blobdifffd($ids ) $bdf
1877
1877
set curdifftag Comments
1878
1878
set curtagstart 0.0
1879
- set diffindex 0
1880
1879
catch {unset difffilestart}
1881
1880
fileevent $bdf readable [list getblobdiffline $bdf $diffids ]
1882
1881
set nextupdate [expr {[clock clicks -milliseconds] + 100}]
1883
1882
}
1884
1883
1885
1884
proc getblobdiffline {bdf ids} {
1886
1885
global diffids blobdifffd ctext curdifftag curtagstart
1887
- global diffnexthead diffnextnote diffindex difffilestart
1888
- global nextupdate diffinhdr
1886
+ global diffnexthead diffnextnote difffilestart
1887
+ global nextupdate diffinhdr treediffs
1889
1888
global gaudydiff
1890
1889
1891
1890
set n [gets $bdf line]
@@ -1902,18 +1901,29 @@ proc getblobdiffline {bdf ids} {
1902
1901
return
1903
1902
}
1904
1903
$ctext conf -state normal
1905
- if {[regexp {^diff --git a/(.*) b/} $line match fname]} {
1904
+ if {[regexp {^diff --git a/(.*) b/(.*) } $line match fname newname ]} {
1906
1905
# start of a new file
1907
1906
$ctext insert end " \n "
1908
1907
$ctext tag add $curdifftag $curtagstart end
1909
1908
set curtagstart [$ctext index " end - 1c" ]
1910
- set header $fname
1909
+ set header $newname
1911
1910
set here [$ctext index " end - 1c" ]
1912
- set difffilestart($diffindex ) $here
1913
- incr diffindex
1914
- # start mark names at fmark.1 for first file
1915
- $ctext mark set fmark.$diffindex $here
1916
- $ctext mark gravity fmark.$diffindex left
1911
+ set i [lsearch -exact $treediffs($diffids) $fname ]
1912
+ if {$i >= 0} {
1913
+ set difffilestart($i ) $here
1914
+ incr i
1915
+ $ctext mark set fmark.$i $here
1916
+ $ctext mark gravity fmark.$i left
1917
+ }
1918
+ if {$newname != $fname } {
1919
+ set i [lsearch -exact $treediffs($diffids) $newname ]
1920
+ if {$i >= 0} {
1921
+ set difffilestart($i ) $here
1922
+ incr i
1923
+ $ctext mark set fmark.$i $here
1924
+ $ctext mark gravity fmark.$i left
1925
+ }
1926
+ }
1917
1927
set curdifftag " f:$fname "
1918
1928
$ctext tag delete $curdifftag
1919
1929
set l [expr {(78 - [string length $header ]) / 2}]
@@ -1973,14 +1983,19 @@ proc nextfile {} {
1973
1983
set here [$ctext index @0,0]
1974
1984
for {set i 0} {[info exists difffilestart($i )]} {incr i} {
1975
1985
if {[$ctext compare $difffilestart($i) > $here ]} {
1976
- $ctext yview $difffilestart($i)
1977
- break
1986
+ if {![info exists pos]
1987
+ || [$ctext compare $difffilestart($i) < $pos ]} {
1988
+ set pos $difffilestart($i)
1989
+ }
1978
1990
}
1979
1991
}
1992
+ if {[info exists pos]} {
1993
+ $ctext yview $pos
1994
+ }
1980
1995
}
1981
1996
1982
1997
proc listboxsel {} {
1983
- global ctext cflist currentid treediffs
1998
+ global ctext cflist currentid
1984
1999
if {![info exists currentid]} return
1985
2000
set sel [lsort [$cflist curselection]]
1986
2001
if {$sel eq {}} return
0 commit comments