@matheusbsbs / matheus-bagliano / commits / e7fb6c69f7
Fork 0

git-gui: Install column headers in blame viewer.

I started to get confused about what each column meant in the blame viewer, and I'm the guy who wrote the code! So now git-gui hints to the user about what each column is by drawing headers at the top. Unfortunately this meant I had to use those dreaded frame objects which seem to cause so much pain on Windows. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jan 29, 2007 at 05:51 UTC e7fb6c69f7612d4e8545f1812a2830f97f183f87
1 file changed +74 -21
git-gui.sh
+74 -21
@@ -3163,70 +3163,120 @@ proc show_blame {commit path} {
3163 -font font_uibold
3164 pack $w.path -anchor w -side top -fill x
3165
3166 - text $w.out.commit -background white -borderwidth 0 \
3166 + set hbg #e2effa
3167 + frame $w.out.commit -width 10 -height 10
3168 + label $w.out.commit.l -text Commit \
3169 + -background $hbg \
3170 + -font font_uibold
3171 + text $w.out.commit.t \
3172 + -background white -borderwidth 0 \
3173 -state disabled \
3174 -wrap none \
3175 -height 40 \
3170 - -width 8 \
3176 + -width 9 \
3177 -font font_diff
3178 + pack $w.out.commit.l -side top -fill x
3179 + pack $w.out.commit.t -fill both
3180 $w.out add $w.out.commit
3173 - lappend texts $w.out.commit
3181 + lappend texts $w.out.commit.t
3182
3175 - text $w.out.author -background white -borderwidth 0 \
3183 + frame $w.out.author -width 10 -height 10
3184 + label $w.out.author.l -text Author \
3185 + -background $hbg \
3186 + -font font_uibold
3187 + text $w.out.author.t \
3188 + -background white -borderwidth 0 \
3189 -state disabled \
3190 -wrap none \
3191 -height 40 \
3192 -width 20 \
3193 -font font_diff
3194 + pack $w.out.author.l -side top -fill x
3195 + pack $w.out.author.t -fill both
3196 $w.out add $w.out.author
3182 - lappend texts $w.out.author
3197 + lappend texts $w.out.author.t
3198
3184 - text $w.out.date -background white -borderwidth 0 \
3199 + frame $w.out.date -width 10 -height 10
3200 + label $w.out.date.l -text Date \
3201 + -background $hbg \
3202 + -font font_uibold
3203 + text $w.out.date.t \
3204 + -background white -borderwidth 0 \
3205 -state disabled \
3206 -wrap none \
3207 -height 40 \
3208 -width [string length "yyyy-mm-dd hh:mm:ss"] \
3209 -font font_diff
3210 + pack $w.out.date.l -side top -fill x
3211 + pack $w.out.date.t -fill both
3212 $w.out add $w.out.date
3191 - lappend texts $w.out.date
3213 + lappend texts $w.out.date.t
3214
3193 - text $w.out.filename -background white -borderwidth 0 \
3215 + frame $w.out.filename -width 10 -height 10
3216 + label $w.out.filename.l -text Filename \
3217 + -background $hbg \
3218 + -font font_uibold
3219 + text $w.out.filename.t \
3220 + -background white -borderwidth 0 \
3221 -state disabled \
3222 -wrap none \
3223 -height 40 \
3224 -width 20 \
3225 -font font_diff
3226 + pack $w.out.filename.l -side top -fill x
3227 + pack $w.out.filename.t -fill both
3228 $w.out add $w.out.filename
3200 - lappend texts $w.out.filename
3229 + lappend texts $w.out.filename.t
3230
3202 - text $w.out.origlinenumber -background white -borderwidth 0 \
3231 + frame $w.out.origlinenumber -width 10 -height 10
3232 + label $w.out.origlinenumber.l -text {Orig Line} \
3233 + -background $hbg \
3234 + -font font_uibold
3235 + text $w.out.origlinenumber.t \
3236 + -background white -borderwidth 0 \
3237 -state disabled \
3238 -wrap none \
3239 -height 40 \
3240 -width 5 \
3241 -font font_diff
3208 - $w.out.origlinenumber tag conf linenumber -justify right
3242 + $w.out.origlinenumber.t tag conf linenumber -justify right
3243 + pack $w.out.origlinenumber.l -side top -fill x
3244 + pack $w.out.origlinenumber.t -fill both
3245 $w.out add $w.out.origlinenumber
3210 - lappend texts $w.out.origlinenumber
3246 + lappend texts $w.out.origlinenumber.t
3247
3212 - text $w.out.linenumber -background white -borderwidth 0 \
3248 + frame $w.out.linenumber -width 10 -height 10
3249 + label $w.out.linenumber.l -text {Curr Line} \
3250 + -background $hbg \
3251 + -font font_uibold
3252 + text $w.out.linenumber.t \
3253 + -background white -borderwidth 0 \
3254 -state disabled \
3255 -wrap none \
3256 -height 40 \
3257 -width 5 \
3258 -font font_diff
3218 - $w.out.linenumber tag conf linenumber -justify right
3259 + $w.out.linenumber.t tag conf linenumber -justify right
3260 + pack $w.out.linenumber.l -side top -fill x
3261 + pack $w.out.linenumber.t -fill both
3262 $w.out add $w.out.linenumber
3220 - lappend texts $w.out.linenumber
3263 + lappend texts $w.out.linenumber.t
3264
3222 - text $w.out.file -background white -borderwidth 0 \
3265 + frame $w.out.file -width 10 -height 10
3266 + label $w.out.file.l -text {File Content} \
3267 + -background $hbg \
3268 + -font font_uibold
3269 + text $w.out.file.t \
3270 + -background white -borderwidth 0 \
3271 -state disabled \
3272 -wrap none \
3273 -height 40 \
3274 -width 80 \
3275 -font font_diff
3276 + pack $w.out.file.l -side top -fill x
3277 + pack $w.out.file.t -fill both
3278 $w.out add $w.out.file
3229 - lappend texts $w.out.file
3279 + lappend texts $w.out.file.t
3280
3281 label $w.status -textvariable blame_status($w) \
3282 -anchor w \
@@ -3236,7 +3286,8 @@ proc show_blame {commit path} {
3286 -font font_ui
3287 pack $w.status -anchor w -side bottom -fill x
3288
3239 - scrollbar $w.sby -orient v -command [list scrollbar2many $texts yview]
3289 + scrollbar $w.sby -orient v \
3290 + -command [list scrollbar2many $texts yview]
3291 pack $w.sby -side right -fill y
3292 pack $w.out -side left -fill both -expand 1
3293
@@ -3249,7 +3300,8 @@ proc show_blame {commit path} {
3300 $i tag conf in_sel \
3301 -background [$i cget -foreground] \
3302 -foreground [$i cget -background]
3252 - $i conf -yscrollcommand [list many2scrollbar $texts yview $w.sby]
3303 + $i conf -yscrollcommand \
3304 + [list many2scrollbar $texts yview $w.sby]
3305 bind $i <Button-1> "blame_highlight $i @%x,%y $texts;break"
3306 bind_button3 $i "
3307 set cursorX %x
@@ -3270,8 +3322,9 @@ proc show_blame {commit path} {
3322 set cmd [list git cat-file blob "$commit:$path"]
3323 set fd [open "| $cmd" r]
3324 fconfigure $fd -blocking 0 -translation lf -encoding binary
3273 - fileevent $fd readable [list read_blame_catfile $fd $w $commit $path \
3274 - $texts $w.out.linenumber $w.out.file]
3325 + fileevent $fd readable [list read_blame_catfile \
3326 + $fd $w $commit $path \
3327 + $texts $w.out.linenumber.t $w.out.file.t]
3328 }
3329
3330 proc read_blame_catfile {fd w commit path texts w_lno w_file} {