gitk: Show current row number and total number of rows
This adds a couple of fields in the bar just below the upper panes that show the row number of the currently selected commit, and how many rows are displayed in total. The latter increments as commits are read in, and thus functions to show that progress is being made. This therefore also removes the code that showed progress using a green oscillating bar in the progress bar window (which some people disliked). Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
e8a0c69b91
commit
6df7403a98
67
gitk
67
gitk
@ -293,11 +293,10 @@ proc parseviewrevs {view revs} {
|
|||||||
|
|
||||||
# Start off a git log process and arrange to read its output
|
# Start off a git log process and arrange to read its output
|
||||||
proc start_rev_list {view} {
|
proc start_rev_list {view} {
|
||||||
global startmsecs commitidx viewcomplete
|
global startmsecs commitidx viewcomplete curview
|
||||||
global commfd leftover tclencoding
|
global commfd leftover tclencoding
|
||||||
global viewargs viewargscmd viewfiles vfilelimit
|
global viewargs viewargscmd viewfiles vfilelimit
|
||||||
global showlocalchanges commitinterest mainheadid
|
global showlocalchanges commitinterest mainheadid
|
||||||
global progressdirn progresscoords proglastnc curview
|
|
||||||
global viewactive loginstance viewinstances vmergeonly
|
global viewactive loginstance viewinstances vmergeonly
|
||||||
global pending_select mainheadid
|
global pending_select mainheadid
|
||||||
global vcanopt vflags vrevs vorigargs
|
global vcanopt vflags vrevs vorigargs
|
||||||
@ -369,9 +368,6 @@ proc start_rev_list {view} {
|
|||||||
filerun $fd [list getcommitlines $fd $i $view 0]
|
filerun $fd [list getcommitlines $fd $i $view 0]
|
||||||
nowbusy $view [mc "Reading"]
|
nowbusy $view [mc "Reading"]
|
||||||
if {$view == $curview} {
|
if {$view == $curview} {
|
||||||
set progressdirn 1
|
|
||||||
set progresscoords {0 0}
|
|
||||||
set proglastnc 0
|
|
||||||
set pending_select $mainheadid
|
set pending_select $mainheadid
|
||||||
}
|
}
|
||||||
set viewcomplete($view) 0
|
set viewcomplete($view) 0
|
||||||
@ -493,12 +489,10 @@ proc updatecommits {} {
|
|||||||
proc reloadcommits {} {
|
proc reloadcommits {} {
|
||||||
global curview viewcomplete selectedline currentid thickerline
|
global curview viewcomplete selectedline currentid thickerline
|
||||||
global showneartags treediffs commitinterest cached_commitrow
|
global showneartags treediffs commitinterest cached_commitrow
|
||||||
global progresscoords targetid
|
global targetid
|
||||||
|
|
||||||
if {!$viewcomplete($curview)} {
|
if {!$viewcomplete($curview)} {
|
||||||
stop_rev_list $curview
|
stop_rev_list $curview
|
||||||
set progresscoords {0 0}
|
|
||||||
adjustprogress
|
|
||||||
}
|
}
|
||||||
resetvarcs $curview
|
resetvarcs $curview
|
||||||
catch {unset selectedline}
|
catch {unset selectedline}
|
||||||
@ -1278,7 +1272,7 @@ proc getcommitlines {fd inst view updating} {
|
|||||||
if {![eof $fd]} {
|
if {![eof $fd]} {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
global commfd viewcomplete viewactive viewname progresscoords
|
global commfd viewcomplete viewactive viewname
|
||||||
global viewinstances
|
global viewinstances
|
||||||
unset commfd($inst)
|
unset commfd($inst)
|
||||||
set i [lsearch -exact $viewinstances($view) $inst]
|
set i [lsearch -exact $viewinstances($view) $inst]
|
||||||
@ -1311,8 +1305,6 @@ proc getcommitlines {fd inst view updating} {
|
|||||||
# appeared in the list
|
# appeared in the list
|
||||||
closevarcs $view
|
closevarcs $view
|
||||||
notbusy $view
|
notbusy $view
|
||||||
set progresscoords {0 0}
|
|
||||||
adjustprogress
|
|
||||||
}
|
}
|
||||||
if {$view == $curview} {
|
if {$view == $curview} {
|
||||||
run chewcommits
|
run chewcommits
|
||||||
@ -1463,33 +1455,6 @@ proc getcommitlines {fd inst view updating} {
|
|||||||
foreach s $scripts {
|
foreach s $scripts {
|
||||||
eval $s
|
eval $s
|
||||||
}
|
}
|
||||||
if {$view == $curview} {
|
|
||||||
# update progress bar
|
|
||||||
global progressdirn progresscoords proglastnc
|
|
||||||
set inc [expr {($commitidx($view) - $proglastnc) * 0.0002}]
|
|
||||||
set proglastnc $commitidx($view)
|
|
||||||
set l [lindex $progresscoords 0]
|
|
||||||
set r [lindex $progresscoords 1]
|
|
||||||
if {$progressdirn} {
|
|
||||||
set r [expr {$r + $inc}]
|
|
||||||
if {$r >= 1.0} {
|
|
||||||
set r 1.0
|
|
||||||
set progressdirn 0
|
|
||||||
}
|
|
||||||
if {$r > 0.2} {
|
|
||||||
set l [expr {$r - 0.2}]
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
set l [expr {$l - $inc}]
|
|
||||||
if {$l <= 0.0} {
|
|
||||||
set l 0.0
|
|
||||||
set progressdirn 1
|
|
||||||
}
|
|
||||||
set r [expr {$l + 0.2}]
|
|
||||||
}
|
|
||||||
set progresscoords [list $l $r]
|
|
||||||
adjustprogress
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 2
|
return 2
|
||||||
}
|
}
|
||||||
@ -1747,7 +1712,7 @@ proc makewindow {} {
|
|||||||
global bgcolor fgcolor bglist fglist diffcolors selectbgcolor
|
global bgcolor fgcolor bglist fglist diffcolors selectbgcolor
|
||||||
global headctxmenu progresscanv progressitem progresscoords statusw
|
global headctxmenu progresscanv progressitem progresscoords statusw
|
||||||
global fprogitem fprogcoord lastprogupdate progupdatepending
|
global fprogitem fprogcoord lastprogupdate progupdatepending
|
||||||
global rprogitem rprogcoord
|
global rprogitem rprogcoord rownumsel numcommits
|
||||||
global have_tk85
|
global have_tk85
|
||||||
|
|
||||||
menu .bar
|
menu .bar
|
||||||
@ -1863,6 +1828,18 @@ proc makewindow {} {
|
|||||||
-state disabled -width 26
|
-state disabled -width 26
|
||||||
pack .tf.bar.rightbut -side left -fill y
|
pack .tf.bar.rightbut -side left -fill y
|
||||||
|
|
||||||
|
label .tf.bar.rowlabel -text [mc "Row"]
|
||||||
|
set rownumsel {}
|
||||||
|
label .tf.bar.rownum -width 7 -font textfont -textvariable rownumsel \
|
||||||
|
-relief sunken -anchor e
|
||||||
|
label .tf.bar.rowlabel2 -text "/"
|
||||||
|
label .tf.bar.numcommits -width 7 -font textfont -textvariable numcommits \
|
||||||
|
-relief sunken -anchor e
|
||||||
|
pack .tf.bar.rowlabel .tf.bar.rownum .tf.bar.rowlabel2 .tf.bar.numcommits \
|
||||||
|
-side left
|
||||||
|
global selectedline
|
||||||
|
trace add variable selectedline {write unset} selectedline_change
|
||||||
|
|
||||||
# Status label and progress bar
|
# Status label and progress bar
|
||||||
set statusw .tf.bar.status
|
set statusw .tf.bar.status
|
||||||
label $statusw -width 15 -relief sunken
|
label $statusw -width 15 -relief sunken
|
||||||
@ -2204,6 +2181,17 @@ proc windows_mousewheel_redirector {W X Y D} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Update row number label when selectedline changes
|
||||||
|
proc selectedline_change {n1 n2 op} {
|
||||||
|
global selectedline rownumsel
|
||||||
|
|
||||||
|
if {$op eq "unset"} {
|
||||||
|
set rownumsel {}
|
||||||
|
} else {
|
||||||
|
set rownumsel [expr {$selectedline + 1}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# mouse-2 makes all windows scan vertically, but only the one
|
# mouse-2 makes all windows scan vertically, but only the one
|
||||||
# the cursor is in scans horizontally
|
# the cursor is in scans horizontally
|
||||||
proc canvscan {op w x y} {
|
proc canvscan {op w x y} {
|
||||||
@ -9877,6 +9865,7 @@ set viewperm(0) 0
|
|||||||
set viewargs(0) {}
|
set viewargs(0) {}
|
||||||
set viewargscmd(0) {}
|
set viewargscmd(0) {}
|
||||||
|
|
||||||
|
set numcommits 0
|
||||||
set loginstance 0
|
set loginstance 0
|
||||||
set cmdlineok 0
|
set cmdlineok 0
|
||||||
set stopped 0
|
set stopped 0
|
||||||
|
Loading…
Reference in New Issue
Block a user