@matheusbsbs / matheus-bagliano / commits / fdedbcfb0d
Fork 0

gitk: Fix various bugs in the view support

- don't re-read refs when switching views, it's too slow; just do it if the user did File->Update - make the view menu use the uifont - if we have a graph line selected, unselect it before changing the view - if a row is selected and appears in the new view, but we have to read in the new view, select that row when we come across it - if no row was previously selected, or if we don't find the previously selected row in the new view, select the first row Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed Apr 6, 2006 at 21:22 UTC fdedbcfb0d71d99f96e08c1903ce8bd5a8f51a39
1 file changed +15 -5
gitk
+15 -5
@@ -223,6 +223,7 @@ proc updatecommits {} {
223 set curview -1
224 catch {unset viewdata($n)}
225 parse_args $revtreeargs
226 + readrefs
227 showview $n
228 }
229
@@ -351,7 +352,8 @@ proc error_popup msg {
352 }
353
354 proc makewindow {} {
354 - global canv canv2 canv3 linespc charspc ctext cflist textfont mainfont uifont
355 + global canv canv2 canv3 linespc charspc ctext cflist
356 + global textfont mainfont uifont
357 global findtype findtypemenu findloc findstring fstring geometry
358 global entries sha1entry sha1string sha1but
359 global maincursor textcursor curtextcursor
@@ -369,7 +371,7 @@ proc makewindow {} {
371 .bar add cascade -label "Edit" -menu .bar.edit
372 .bar.edit add command -label "Preferences" -command doprefs
373 .bar.edit configure -font $uifont
372 - menu .bar.view
374 + menu .bar.view -font $uifont
375 .bar add cascade -label "View" -menu .bar.view
376 .bar.view add command -label "New view..." -command newview
377 .bar.view add command -label "Delete view" -command delview -state disabled
@@ -907,6 +909,7 @@ proc showview {n} {
909 }
910 }
911 unselectline
912 + normalline
913 stopfindproc
914 if {$curview >= 0 && $phase eq {} && ![info exists viewdata($curview)]} {
915 set viewdata($curview) \
@@ -916,7 +919,6 @@ proc showview {n} {
919 catch {unset matchinglines}
920 catch {unset treediffs}
921 clear_display
919 - readrefs
922
923 set curview $n
924 .bar.view entryconf 2 -state [expr {$n == 0? "disabled": "normal"}]
@@ -1159,7 +1161,7 @@ proc layoutmore {} {
1161 }
1162
1163 proc showstuff {canshow} {
1162 - global numcommits commitrow pending_select
1164 + global numcommits commitrow pending_select selectedline
1165 global linesegends idrowranges idrangedrawn
1166
1167 if {$numcommits == 0} {
@@ -1201,6 +1203,9 @@ proc showstuff {canshow} {
1203 $commitrow($pending_select) < $numcommits} {
1204 selectline $commitrow($pending_select) 1
1205 }
1206 + if {![info exists selectedline] && ![info exists pending_select]} {
1207 + selectline 0 1
1208 + }
1209 }
1210
1211 proc layoutrows {row endrow last} {
@@ -1989,7 +1994,7 @@ proc xcoord {i level ln} {
1994 proc finishcommits {} {
1995 global commitidx phase
1996 global canv mainfont ctext maincursor textcursor
1992 - global findinprogress
1997 + global findinprogress pending_select
1998
1999 if {$commitidx > 0} {
2000 drawrest
@@ -2003,6 +2008,7 @@ proc finishcommits {} {
2008 settextcursor $textcursor
2009 }
2010 set phase {}
2011 + catch {unset pending_select}
2012 }
2013
2014 # Don't change the text pane cursor if it is currently the hand cursor,
@@ -2021,12 +2027,16 @@ proc drawrest {} {
2027 global startmsecs
2028 global canvy0 numcommits linespc
2029 global rowlaidout commitidx
2030 + global pending_select
2031
2032 set row $rowlaidout
2033 layoutrows $rowlaidout $commitidx 1
2034 layouttail
2035 optimize_rows $row 0 $commitidx
2036 showstuff $commitidx
2037 + if {[info exists pending_select]} {
2038 + selectline 0 1
2039 + }
2040
2041 set drawmsecs [expr {[clock clicks -milliseconds] - $startmsecs}]
2042 #puts "overall $drawmsecs ms for $numcommits commits"