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

[PATCH] gitk: Display commit messages with word wrap

Some people put very long strings into commit messages, which then become invisible in gitk (word wrapping in the commit details window is turned off, and there is no horizontal scroll bar). Enabling word wrap for just the commit message looks much better. Wrapping is controlled by the "wrapcomment" option in ~/.gitk. By default this option is set to "none", which disables wrapping; setting it to "word" enables word wrap for commit messages. Signed-off-by: Sergey Vlasov <vsu@altlinux.ru> Signed-off-by: Paul Mackerras <paulus@samba.org>

Sergey Vlasov committed May 15, 2006 at 19:13 UTC f1b8629453f6a0aeaee7072af7d900f3054a9aca
1 file changed +14 -12
gitk
+14 -12
@@ -380,7 +380,7 @@ proc makewindow {} {
380 global findtype findtypemenu findloc findstring fstring geometry
381 global entries sha1entry sha1string sha1but
382 global maincursor textcursor curtextcursor
383 - global rowctxmenu mergemax
383 + global rowctxmenu mergemax wrapcomment
384
385 menu .bar
386 .bar add cascade -label "File" -menu .bar.file
@@ -527,6 +527,7 @@ proc makewindow {} {
527 pack $ctext -side left -fill both -expand 1
528 .ctop.cdet add .ctop.cdet.left
529
530 + $ctext tag conf comment -wrap $wrapcomment
531 $ctext tag conf filesep -font [concat $textfont bold] -back "#aaaaaa"
532 $ctext tag conf hunksep -fore blue
533 $ctext tag conf d0 -fore red
@@ -696,7 +697,7 @@ proc savestuff {w} {
697 global stuffsaved findmergefiles maxgraphpct
698 global maxwidth
699 global viewname viewfiles viewargs viewperm nextviewnum
699 - global cmitmode
700 + global cmitmode wrapcomment
701
702 if {$stuffsaved} return
703 if {![winfo viewable .]} return
@@ -709,6 +710,7 @@ proc savestuff {w} {
710 puts $f [list set maxgraphpct $maxgraphpct]
711 puts $f [list set maxwidth $maxwidth]
712 puts $f [list set cmitmode $cmitmode]
713 + puts $f [list set wrapcomment $wrapcomment]
714 puts $f "set geometry(width) [winfo width .ctop]"
715 puts $f "set geometry(height) [winfo height .ctop]"
716 puts $f "set geometry(canv1) [expr {[winfo width $canv]-2}]"
@@ -3225,11 +3227,11 @@ proc commit_descriptor {p} {
3227
3228 # append some text to the ctext widget, and make any SHA1 ID
3229 # that we know about be a clickable link.
3228 -proc appendwithlinks {text} {
3230 +proc appendwithlinks {text tags} {
3231 global ctext commitrow linknum curview
3232
3233 set start [$ctext index "end - 1c"]
3232 - $ctext insert end $text
3234 + $ctext insert end $text $tags
3235 $ctext insert end "\n"
3236 set links [regexp -indices -all -inline {[0-9a-f]{40}} $text]
3237 foreach l $links {
@@ -3357,7 +3359,7 @@ proc selectline {l isnew} {
3359 $ctext insert end "\n"
3360 }
3361
3360 - set comment {}
3362 + set headers {}
3363 set olds [lindex $parentlist $l]
3364 if {[llength $olds] > 1} {
3365 set np 0
@@ -3368,23 +3370,22 @@ proc selectline {l isnew} {
3370 set tag m$np
3371 }
3372 $ctext insert end "Parent: " $tag
3371 - appendwithlinks [commit_descriptor $p]
3373 + appendwithlinks [commit_descriptor $p] {}
3374 incr np
3375 }
3376 } else {
3377 foreach p $olds {
3376 - append comment "Parent: [commit_descriptor $p]\n"
3378 + append headers "Parent: [commit_descriptor $p]\n"
3379 }
3380 }
3381
3382 foreach c [lindex $childlist $l] {
3381 - append comment "Child: [commit_descriptor $c]\n"
3383 + append headers "Child: [commit_descriptor $c]\n"
3384 }
3383 - append comment "\n"
3384 - append comment [lindex $info 5]
3385
3386 # make anything that looks like a SHA1 ID be a clickable link
3387 - appendwithlinks $comment
3387 + appendwithlinks $headers {}
3388 + appendwithlinks [lindex $info 5] {comment}
3389
3390 $ctext tag delete Comments
3391 $ctext tag remove found 1.0 end
@@ -4508,7 +4509,7 @@ proc showtag {tag isnew} {
4509 } else {
4510 set text "Tag: $tag\nId: $tagids($tag)"
4511 }
4511 - appendwithlinks $text
4512 + appendwithlinks $text {}
4513 $ctext conf -state disabled
4514 init_flist {}
4515 }
@@ -4894,6 +4895,7 @@ set downarrowlen 7
4895 set mingaplen 30
4896 set flistmode "flat"
4897 set cmitmode "patch"
4898 +set wrapcomment "none"
4899
4900 set colors {green red blue magenta darkgrey brown orange}
4901