@@ -1671,7 +1671,7 @@ proc showview {n} {
1671
1671
global pending_select phase
1672
1672
global commitidx rowlaidout rowoptim linesegends
1673
1673
global commfd nextupdate
1674
- global selectedview
1674
+ global selectedview selectfirst
1675
1675
global vparentlist vchildlist vdisporder vcmitlisted
1676
1676
global hlview selectedhlview
1677
1677
@@ -1689,6 +1689,9 @@ proc showview {n} {
1689
1689
} else {
1690
1690
set yscreen [expr {($ybot - $ytop ) / 2}]
1691
1691
}
1692
+ } elseif {[info exists pending_select]} {
1693
+ set selid $pending_select
1694
+ unset pending_select
1692
1695
}
1693
1696
unselectline
1694
1697
normalline
@@ -1723,7 +1726,9 @@ proc showview {n} {
1723
1726
.bar.view entryconf Delete* -state [expr {$n == 0? " disabled" : " normal" }]
1724
1727
1725
1728
if {![info exists viewdata($n )]} {
1726
- set pending_select $selid
1729
+ if {$selid ne {}} {
1730
+ set pending_select $selid
1731
+ }
1727
1732
getcommits
1728
1733
return
1729
1734
}
@@ -1757,7 +1762,8 @@ proc showview {n} {
1757
1762
set row 0
1758
1763
setcanvscroll
1759
1764
set yf 0
1760
- set row 0
1765
+ set row {}
1766
+ set selectfirst 0
1761
1767
if {$selid ne {} && [info exists commitrow($n ,$selid )]} {
1762
1768
set row $commitrow($n,$selid)
1763
1769
# try to get the selected row in the same position on the screen
@@ -1770,7 +1776,17 @@ proc showview {n} {
1770
1776
}
1771
1777
allcanvs yview moveto $yf
1772
1778
drawvisible
1773
- selectline $row 0
1779
+ if {$row ne {}} {
1780
+ selectline $row 0
1781
+ } elseif {$selid ne {}} {
1782
+ set pending_select $selid
1783
+ } else {
1784
+ if {$numcommits > 0} {
1785
+ selectline 0 0
1786
+ } else {
1787
+ set selectfirst 1
1788
+ }
1789
+ }
1774
1790
if {$phase ne {}} {
1775
1791
if {$phase eq " getcommits" } {
1776
1792
show_status " Reading commits..."
@@ -2407,7 +2423,7 @@ proc initlayout {} {
2407
2423
global nextcolor
2408
2424
global parentlist childlist children
2409
2425
global colormap rowtextx
2410
- global linesegends
2426
+ global linesegends selectfirst
2411
2427
2412
2428
set numcommits 0
2413
2429
set displayorder {}
@@ -2427,6 +2443,7 @@ proc initlayout {} {
2427
2443
catch {unset rowtextx}
2428
2444
catch {unset idrowranges}
2429
2445
set linesegends {}
2446
+ set selectfirst 1
2430
2447
}
2431
2448
2432
2449
proc setcanvscroll {} {
@@ -2495,6 +2512,7 @@ proc layoutmore {tmax} {
2495
2512
proc showstuff {canshow} {
2496
2513
global numcommits commitrow pending_select selectedline
2497
2514
global linesegends idrowranges idrangedrawn curview
2515
+ global displayorder selectfirst
2498
2516
2499
2517
if {$numcommits == 0} {
2500
2518
global phase
@@ -2533,8 +2551,13 @@ proc showstuff {canshow} {
2533
2551
$commitrow($curview,$pending_select) < $numcommits } {
2534
2552
selectline $commitrow($curview,$pending_select) 1
2535
2553
}
2536
- if {![info exists selectedline] && ![info exists pending_select]} {
2537
- selectline 0 1
2554
+ if {$selectfirst } {
2555
+ if {[info exists selectedline] || [info exists pending_select]} {
2556
+ set selectfirst 0
2557
+ } else {
2558
+ selectline 0 1
2559
+ set selectfirst 0
2560
+ }
2538
2561
}
2539
2562
}
2540
2563
@@ -3551,7 +3574,6 @@ proc drawrest {} {
3551
3574
global rowlaidout commitidx curview
3552
3575
global pending_select
3553
3576
3554
- set row $rowlaidout
3555
3577
layoutrows $rowlaidout $commitidx($curview) 1
3556
3578
layouttail
3557
3579
optimize_rows $row 0 $commitidx($curview)
0 commit comments