git-gui: Clip the commit summaries in the blame history menu
[gitweb.git] / lib / blame.tcl
index 33e8489d067c4955f72075fe1de22482f0463e30..85e9e0dc32e08361a755bea65811274cff984d39 100644 (file)
@@ -66,14 +66,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 \
@@ -386,6 +390,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]
@@ -518,8 +525,10 @@ 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
                        }
@@ -572,8 +581,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 +812,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