git-gui: Automatically expand the line number column as needed
After we finish reading a chunk of data from the file stream we know how many digits we need in the line number column to show the current maximum line number. If our line number column isn't wide enough, we should expand it out to the correct width. Any file over our default allowance of 5 digits (99,999 lines) is so large that the slight UI "glitch" when we widen the column out is trivial compared to the time it will take Git to fully do the annotations. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Jun 2, 2007 at 14:41 UTC
81fb7efeda2ce14cbb44b91eed37aeeb2e541832
1 file changed
+7
lib/blame.tcl
+7
@@ -422,12 +422,19 @@ method _read_file {fd} {
422
$w_line insert end "$total_lines" linenumber
423
$w_file insert end "$line"
424
}
425
+
426
+ set ln_wc [expr {[string length $total_lines] + 2}]
427
+ if {[$w_line cget -width] < $ln_wc} {
428
+ $w_line conf -width $ln_wc
429
+ }
430
+
431
$w_cgrp conf -state disabled
432
$w_line conf -state disabled
433
$w_file conf -state disabled
434
435
if {[eof $fd]} {
436
close $fd
437
+
438
_status $this
439
set cmd {nice git blame -M -C --incremental}
440
if {$commit eq {}} {