git-gui: Remove unnecessary space between columns in blame viewer
[gitweb.git] / lib / blame.tcl
index 33e8489d067c4955f72075fe1de22482f0463e30..1346fa54526448339295cdc949dfae639170bb57 100644 (file)
@@ -14,7 +14,6 @@ field w_back     ; # our back button
 field w_path     ; # label showing the current file path
 field w_line     ; # text column: all line numbers
 field w_cgrp     ; # text column: abbreviated commit SHA-1s
-field w_load     ; # text column: loaded indicator
 field w_file     ; # text column: actual file data
 field w_cmit     ; # pane showing commit message
 field status     ; # text variable bound to status bar
@@ -66,14 +65,18 @@ constructor new {i_commit i_path} {
                -anchor w \
                -justify left
        set w_back $w.header.commit_b
-       button $w_back \
-               -command [cb _history_menu] \
+       label $w_back \
                -image ::blame::img_back_arrow \
                -borderwidth 0 \
                -relief flat \
                -state disabled \
                -background orange \
                -activebackground orange
+       bind $w_back <Button-1> "
+               if {\[$w_back cget -state\] eq {normal}} {
+                       [cb _history_menu]
+               }
+               "
        label $w.header.commit \
                -textvariable @commit \
                -background orange \
@@ -109,28 +112,24 @@ constructor new {i_commit i_path} {
                -height 25 \
                -width 100
 
-       set w_load $w.file_pane.out.loaded_t
-       text $w_load \
-               -background white -borderwidth 0 \
-               -state disabled \
-               -wrap none \
-               -height 40 \
-               -width 1 \
-               -font font_diff
-       $w_load tag conf annotated -background grey
-
        set w_line $w.file_pane.out.linenumber_t
        text $w_line \
+               -takefocus 0 \
+               -highlightthickness 0 \
+               -padx 0 -pady 0 \
                -background white -borderwidth 0 \
                -state disabled \
                -wrap none \
                -height 40 \
                -width 5 \
                -font font_diff
-       $w_line tag conf linenumber -justify right
+       $w_line tag conf linenumber -justify right -rmargin 5
 
        set w_cgrp $w.file_pane.out.commit_t
        text $w_cgrp \
+               -takefocus 0 \
+               -highlightthickness 0 \
+               -padx 0 -pady 0 \
                -background white -borderwidth 0 \
                -state disabled \
                -wrap none \
@@ -147,6 +146,9 @@ constructor new {i_commit i_path} {
 
        set w_file $w.file_pane.out.file_t
        text $w_file \
+               -takefocus 0 \
+               -highlightthickness 0 \
+               -padx 0 -pady 0 \
                -background white -borderwidth 0 \
                -state disabled \
                -wrap none \
@@ -161,7 +163,6 @@ constructor new {i_commit i_path} {
        scrollbar $w.file_pane.out.sby \
                -orient v \
                -command [list scrollbar2many [list \
-               $w_load \
                $w_line \
                $w_cgrp \
                $w_file \
@@ -169,12 +170,11 @@ constructor new {i_commit i_path} {
        grid \
                $w_cgrp \
                $w_line \
-               $w_load \
                $w_file \
                $w.file_pane.out.sby \
                -sticky nsew
-       grid conf $w.file_pane.out.sbx -column 3 -sticky we
-       grid columnconfigure $w.file_pane.out 3 -weight 1
+       grid conf $w.file_pane.out.sbx -column 2 -sticky we
+       grid columnconfigure $w.file_pane.out 2 -weight 1
        grid rowconfigure $w.file_pane.out 0 -weight 1
 
        set w_cmit $w.file_pane.cm.t
@@ -221,14 +221,12 @@ constructor new {i_commit i_path} {
 
        foreach i [list \
                $w_cgrp \
-               $w_load \
                $w_line \
                $w_file] {
                $i conf -cursor $cursor_ptr
                $i conf -yscrollcommand \
                        [list many2scrollbar [list \
                        $w_cgrp \
-                       $w_load \
                        $w_line \
                        $w_file \
                        ] yview $w.file_pane.out.sby]
@@ -251,7 +249,6 @@ constructor new {i_commit i_path} {
 
        foreach i [list \
                $w_cgrp \
-               $w_load \
                $w_line \
                $w_file \
                $w_cmit] {
@@ -316,17 +313,14 @@ method _load {} {
                array unset line_commit
                array unset line_file
 
-               $w_load conf -state normal
                $w_cgrp conf -state normal
                $w_line conf -state normal
                $w_file conf -state normal
 
-               $w_load delete 0.0 end
                $w_cgrp delete 0.0 end
                $w_line delete 0.0 end
                $w_file delete 0.0 end
 
-               $w_load conf -state disabled
                $w_cgrp conf -state disabled
                $w_line conf -state disabled
                $w_file conf -state disabled
@@ -386,6 +380,9 @@ method _history_menu {} {
                }
                if {![catch {set summary $header($c,summary)}]} {
                        append t " $summary"
+                       if {[string length $t] > 70} {
+                               set t [string range $t 0 66]...
+                       }
                }
 
                $m add command -label $t -command [cb _goback $i $c $f]
@@ -408,7 +405,6 @@ method _read_file {fd} {
                return
        }
 
-       $w_load conf -state normal
        $w_cgrp conf -state normal
        $w_line conf -state normal
        $w_file conf -state normal
@@ -417,7 +413,6 @@ method _read_file {fd} {
                incr total_lines
 
                if {$total_lines > 1} {
-                       $w_load insert end "\n"
                        $w_cgrp insert end "\n"
                        $w_line insert end "\n"
                        $w_file insert end "\n"
@@ -426,7 +421,6 @@ method _read_file {fd} {
                $w_line insert end "$total_lines" linenumber
                $w_file insert end "$line"
        }
-       $w_load conf -state disabled
        $w_cgrp conf -state disabled
        $w_line conf -state disabled
        $w_file conf -state disabled
@@ -518,17 +512,17 @@ method _read_blame {fd} {
 
                        set first_lno $lno
                        while {
-                       ![catch {set ncmit $line_commit([expr {$first_lno - 1}])}]
+                          ![catch {set ncmit $line_commit([expr {$first_lno - 1}])}]
+                       && ![catch {set nfile $line_file([expr {$first_lno - 1}])}]
                        && $ncmit eq $cmit
+                       && $nfile eq $file
                        } {
                                incr first_lno -1
                        }
 
                        while {$n > 0} {
                                set lno_e "$lno.0 lineend + 1c"
-                               if {[catch {set g g$line_commit($lno)}]} {
-                                       $w_load tag add annotated $lno.0 $lno_e
-                               } else {
+                               if {![catch {set g g$line_commit($lno)}]} {
                                        $w_cgrp tag remove g$g $lno.0 $lno_e
                                        $w_line tag remove g$g $lno.0 $lno_e
                                        $w_file tag remove g$g $lno.0 $lno_e
@@ -572,8 +566,12 @@ method _read_blame {fd} {
                                incr blame_lines
                        }
 
-                       while {![catch {set ncmit $line_commit($lno)}]
-                               && $ncmit eq $cmit} {
+                       while {
+                          ![catch {set ncmit $line_commit($lno)}]
+                       && ![catch {set nfile $line_file($lno)}]
+                       && $ncmit eq $cmit
+                       && $nfile eq $file
+                       } {
                                $w_cgrp delete $lno.0 "$lno.0 lineend"
 
                                if {$lno == $first_lno} {
@@ -799,6 +797,13 @@ method _open_tooltip {cur_w} {
 $author_name $author_email  $author_time
 $summary"
 
+       set file $line_file($lno)
+       if {$file ne $path} {
+               append tooltip_text "
+
+Original File: $file"
+       }
+
        if {$tooltip_wm ne "$cur_w.tooltip"} {
                _hide_tooltip $this