aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-06-02 14:41:10 -0400
committerShawn O. Pearce <spearce@spearce.org>2007-06-06 01:26:49 -0400
commit81fb7efeda2ce14cbb44b91eed37aeeb2e541832 (patch)
treea89eaea27da5c9d26a4d04afaf15f22562da0fdd
parent375e1365a62df3cd944ec0e91051b94d710a7c6d (diff)
downloadgit-81fb7efeda2ce14cbb44b91eed37aeeb2e541832.tar.gz
git-81fb7efeda2ce14cbb44b91eed37aeeb2e541832.tar.xz
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>
-rw-r--r--lib/blame.tcl7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/blame.tcl b/lib/blame.tcl
index 556170268..0666dcadc 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -422,12 +422,19 @@ method _read_file {fd} {
$w_line insert end "$total_lines" linenumber
$w_file insert end "$line"
}
+
+ set ln_wc [expr {[string length $total_lines] + 2}]
+ if {[$w_line cget -width] < $ln_wc} {
+ $w_line conf -width $ln_wc
+ }
+
$w_cgrp conf -state disabled
$w_line conf -state disabled
$w_file conf -state disabled
if {[eof $fd]} {
close $fd
+
_status $this
set cmd {nice git blame -M -C --incremental}
if {$commit eq {}} {