{"thread":{"id":"4134","subject":"[PATCH] gitk: Display commit messages with word wrap","startedAt":"2006-05-14T15:14:56Z","lastAt":"2006-05-15T15:13:14Z","messageCount":6,"participants":["Sergey Vlasov","Junio C Hamano","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"19908","messageId":"20060514151456.GA18012@procyon.home","threadId":"4134","inReplyTo":null,"subject":"[PATCH] gitk: Display commit messages with word wrap","fromName":"Sergey Vlasov","fromEmail":"vsu@altlinux.ru","sentAt":"2006-05-14T15:14:56Z","receivedAt":"2006-05-14T15:14:56Z","isPatch":true,"sender":{"key":"vsu@altlinux.ru","avatar":"https://avatars.githubusercontent.com/u/616082?v=4"},"body":"Some people put very long strings into commit messages, which then\nbecome invisible in gitk (word wrapping in the commit details window is\nturned off, and there is no horizontal scroll bar).  Enabling word wrap\nfor just the commit message looks much better.\n\nSigned-off-by: Sergey Vlasov <vsu@altlinux.ru>\n\n\n---\n\n gitk |   22 +++++++++++-----------\n 1 files changed, 11 insertions(+), 11 deletions(-)\n\nbe428b9cd6287b214e61c614bd4c4b4fa3d20075\ndiff --git a/gitk b/gitk\nindex 4aa57c0..41f25df 100755\n--- a/gitk\n+++ b/gitk\n@@ -527,6 +527,7 @@ proc makewindow {} {\n     pack $ctext -side left -fill both -expand 1\n     .ctop.cdet add .ctop.cdet.left\n \n+    $ctext tag conf comment -wrap word\n     $ctext tag conf filesep -font [concat $textfont bold] -back \"#aaaaaa\"\n     $ctext tag conf hunksep -fore blue\n     $ctext tag conf d0 -fore red\n@@ -3222,12 +3223,12 @@ proc commit_descriptor {p} {\n \n # append some text to the ctext widget, and make any SHA1 ID\n # that we know about be a clickable link.\n-proc appendwithlinks {text} {\n+proc appendwithlinks {text tags} {\n     global ctext commitrow linknum curview\n \n     set start [$ctext index \"end - 1c\"]\n-    $ctext insert end $text\n-    $ctext insert end \"\\n\"\n+    $ctext insert end $text $tags\n+    $ctext insert end \"\\n\" {}\n     set links [regexp -indices -all -inline {[0-9a-f]{40}} $text]\n     foreach l $links {\n \tset s [lindex $l 0]\n@@ -3354,7 +3355,7 @@ proc selectline {l isnew} {\n \t$ctext insert end \"\\n\"\n     }\n  \n-    set comment {}\n+    set headers {}\n     set olds [lindex $parentlist $l]\n     if {[llength $olds] > 1} {\n \tset np 0\n@@ -3365,23 +3366,22 @@ proc selectline {l isnew} {\n \t\tset tag m$np\n \t    }\n \t    $ctext insert end \"Parent: \" $tag\n-\t    appendwithlinks [commit_descriptor $p]\n+\t    appendwithlinks [commit_descriptor $p] {}\n \t    incr np\n \t}\n     } else {\n \tforeach p $olds {\n-\t    append comment \"Parent: [commit_descriptor $p]\\n\"\n+\t    append headers \"Parent: [commit_descriptor $p]\\n\"\n \t}\n     }\n \n     foreach c [lindex $childlist $l] {\n-\tappend comment \"Child:  [commit_descriptor $c]\\n\"\n+\tappend headers \"Child:  [commit_descriptor $c]\\n\"\n     }\n-    append comment \"\\n\"\n-    append comment [lindex $info 5]\n \n     # make anything that looks like a SHA1 ID be a clickable link\n-    appendwithlinks $comment\n+    appendwithlinks $headers {}\n+    appendwithlinks [lindex $info 5] {comment}\n \n     $ctext tag delete Comments\n     $ctext tag remove found 1.0 end\n@@ -4504,7 +4504,7 @@ proc showtag {tag isnew} {\n     } else {\n \tset text \"Tag: $tag\\nId:  $tagids($tag)\"\n     }\n-    appendwithlinks $text\n+    appendwithlinks $text {}\n     $ctext conf -state disabled\n     init_flist {}\n }\n-- \n1.3.2.g8252\n"},{"id":"19938","messageId":"7v4pzs18wl.fsf@assigned-by-dhcp.cox.net","threadId":"4134","inReplyTo":"20060514151456.GA18012@procyon.home","subject":"Re: [PATCH] gitk: Display commit messages with word wrap","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-05-14T23:30:50Z","receivedAt":"2006-05-14T23:30:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Vlasov <vsu@altlinux.ru> writes:\n\n> Some people put very long strings into commit messages, which then\n> become invisible in gitk (word wrapping in the commit details window is\n> turned off, and there is no horizontal scroll bar).  Enabling word wrap\n> for just the commit message looks much better.\n\nI do not mind it myself but IIRC gitk's \"no wrapping\" was made\nbecause people found wrapping annoying; maybe a runtime\nconfiguration option?\n"},{"id":"19939","messageId":"17511.48749.631725.358279@cargo.ozlabs.ibm.com","threadId":"4134","inReplyTo":"20060514151456.GA18012@procyon.home","subject":"Re: [PATCH] gitk: Display commit messages with word wrap","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2006-05-14T23:34:05Z","receivedAt":"2006-05-14T23:34:05Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Sergey Vlasov writes:\n\n> Some people put very long strings into commit messages, which then\n> become invisible in gitk (word wrapping in the commit details window is\n> turned off, and there is no horizontal scroll bar).  Enabling word wrap\n> for just the commit message looks much better.\n\nWell... you can scroll in any direction with mouse button 2, but ok...\n\n> +    $ctext insert end \"\\n\" {}\n\nWhy are you adding the superfluous {} ?\n\n> -    set comment {}\n> +    set headers {}\n\nWhy are you changing the name here?  Your commit description doesn't\naddress either of these points.\n\nPaul.\n"},{"id":"19995","messageId":"20060515150619.GC19254@master.mivlgu.local","threadId":"4134","inReplyTo":"17511.48749.631725.358279@cargo.ozlabs.ibm.com","subject":"Re: [PATCH] gitk: Display commit messages with word wrap","fromName":"Sergey Vlasov","fromEmail":"vsu@altlinux.ru","sentAt":"2006-05-15T15:06:19Z","receivedAt":"2006-05-15T15:06:19Z","isPatch":true,"sender":{"key":"vsu@altlinux.ru","avatar":"https://avatars.githubusercontent.com/u/616082?v=4"},"body":"On Mon, May 15, 2006 at 09:34:05AM +1000, Paul Mackerras wrote:\n> Sergey Vlasov writes:\n> \n> > Some people put very long strings into commit messages, which then\n> > become invisible in gitk (word wrapping in the commit details window is\n> > turned off, and there is no horizontal scroll bar).  Enabling word wrap\n> > for just the commit message looks much better.\n> \n> Well... you can scroll in any direction with mouse button 2, but ok...\n\nI completely forgot about this obscure feature of Tk (and is it only me\nwho thinks that it scrolls in the wrong direction?).\n\n> > +    $ctext insert end \"\\n\" {}\n> \n> Why are you adding the superfluous {} ?\n\nBecause I was paranoid about not letting the tag leak into subsequent\ntext...  but apparently this does not happen even without that {}, so I'll\nremove it.\n\n> > -    set comment {}\n> > +    set headers {}\n> \n> Why are you changing the name here?  Your commit description doesn't\n> address either of these points.\n\nPreviously the \"comment\" variable contained both the commit headers\n(\"Parent:\" and \"Child:\" lines) and the commit message, and all this text\nwas inserted into $ctext by a single call to \"appendwithlinks\".  Now I\nneed to insert these parts separately (wrapped \"Parent:\" and \"Child:\"\nlines look bad, I want to wrap only the commit message), therefore only\nheaders are collected in that variable - so I renamed it to reflect this\nnew usage.\n\nI'll send the updated patch in a separate message.\n"},{"id":"19996","messageId":"20060515150731.GD19254@master.mivlgu.local","threadId":"4134","inReplyTo":"7v4pzs18wl.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitk: Display commit messages with word wrap","fromName":"Sergey Vlasov","fromEmail":"vsu@altlinux.ru","sentAt":"2006-05-15T15:07:31Z","receivedAt":"2006-05-15T15:07:31Z","isPatch":true,"sender":{"key":"vsu@altlinux.ru","avatar":"https://avatars.githubusercontent.com/u/616082?v=4"},"body":"On Sun, May 14, 2006 at 04:30:50PM -0700, Junio C Hamano wrote:\n> Sergey Vlasov <vsu@altlinux.ru> writes:\n> \n> > Some people put very long strings into commit messages, which then\n> > become invisible in gitk (word wrapping in the commit details window is\n> > turned off, and there is no horizontal scroll bar).  Enabling word wrap\n> > for just the commit message looks much better.\n> \n> I do not mind it myself but IIRC gitk's \"no wrapping\" was made\n> because people found wrapping annoying; maybe a runtime\n> configuration option?\n\nOK, added a hidden option in ~/.gitk which defaults to \"no wrapping\", so\nmost users will not notice anything...\n"},{"id":"19998","messageId":"20060515151314.GE19254@master.mivlgu.local","threadId":"4134","inReplyTo":"17511.48749.631725.358279@cargo.ozlabs.ibm.com","subject":"[PATCH] gitk: Display commit messages with word wrap (try 2)","fromName":"Sergey Vlasov","fromEmail":"vsu@altlinux.ru","sentAt":"2006-05-15T15:13:14Z","receivedAt":"2006-05-15T15:13:14Z","isPatch":true,"sender":{"key":"vsu@altlinux.ru","avatar":"https://avatars.githubusercontent.com/u/616082?v=4"},"body":"Some people put very long strings into commit messages, which then\nbecome invisible in gitk (word wrapping in the commit details window is\nturned off, and there is no horizontal scroll bar).  Enabling word wrap\nfor just the commit message looks much better.\n\nWrapping is controlled by the \"wrapcomment\" option in ~/.gitk.  By\ndefault this option is set to \"none\", which disables wrapping; setting\nit to \"word\" enables word wrap for commit messages.\n\nSigned-off-by: Sergey Vlasov <vsu@altlinux.ru>\n\n---\n\n gitk |   26 ++++++++++++++------------\n 1 files changed, 14 insertions(+), 12 deletions(-)\n\n The text about the \"comment\" variable IMHO just does not fit in the\n commit message above - if you prefer, I'll just make two separate\n patches, the first which leaves the \"comment\" name in place (ignoring the\n fact that the variable is no longer holding the comment text), and the\n second which just renames it to \"headers\".\n\nf23c00577c9a4379c794313f8e54132a159f7f43\ndiff --git a/gitk b/gitk\nindex 4aa57c0..8d046af 100755\n--- a/gitk\n+++ b/gitk\n@@ -380,7 +380,7 @@ proc makewindow {} {\n     global findtype findtypemenu findloc findstring fstring geometry\n     global entries sha1entry sha1string sha1but\n     global maincursor textcursor curtextcursor\n-    global rowctxmenu mergemax\n+    global rowctxmenu mergemax wrapcomment\n \n     menu .bar\n     .bar add cascade -label \"File\" -menu .bar.file\n@@ -527,6 +527,7 @@ proc makewindow {} {\n     pack $ctext -side left -fill both -expand 1\n     .ctop.cdet add .ctop.cdet.left\n \n+    $ctext tag conf comment -wrap $wrapcomment\n     $ctext tag conf filesep -font [concat $textfont bold] -back \"#aaaaaa\"\n     $ctext tag conf hunksep -fore blue\n     $ctext tag conf d0 -fore red\n@@ -696,7 +697,7 @@ proc savestuff {w} {\n     global stuffsaved findmergefiles maxgraphpct\n     global maxwidth\n     global viewname viewfiles viewargs viewperm nextviewnum\n-    global cmitmode\n+    global cmitmode wrapcomment\n \n     if {$stuffsaved} return\n     if {![winfo viewable .]} return\n@@ -709,6 +710,7 @@ proc savestuff {w} {\n \tputs $f [list set maxgraphpct $maxgraphpct]\n \tputs $f [list set maxwidth $maxwidth]\n \tputs $f [list set cmitmode $cmitmode]\n+\tputs $f [list set wrapcomment $wrapcomment]\n \tputs $f \"set geometry(width) [winfo width .ctop]\"\n \tputs $f \"set geometry(height) [winfo height .ctop]\"\n \tputs $f \"set geometry(canv1) [expr {[winfo width $canv]-2}]\"\n@@ -3222,11 +3224,11 @@ proc commit_descriptor {p} {\n \n # append some text to the ctext widget, and make any SHA1 ID\n # that we know about be a clickable link.\n-proc appendwithlinks {text} {\n+proc appendwithlinks {text tags} {\n     global ctext commitrow linknum curview\n \n     set start [$ctext index \"end - 1c\"]\n-    $ctext insert end $text\n+    $ctext insert end $text $tags\n     $ctext insert end \"\\n\"\n     set links [regexp -indices -all -inline {[0-9a-f]{40}} $text]\n     foreach l $links {\n@@ -3354,7 +3356,7 @@ proc selectline {l isnew} {\n \t$ctext insert end \"\\n\"\n     }\n  \n-    set comment {}\n+    set headers {}\n     set olds [lindex $parentlist $l]\n     if {[llength $olds] > 1} {\n \tset np 0\n@@ -3365,23 +3367,22 @@ proc selectline {l isnew} {\n \t\tset tag m$np\n \t    }\n \t    $ctext insert end \"Parent: \" $tag\n-\t    appendwithlinks [commit_descriptor $p]\n+\t    appendwithlinks [commit_descriptor $p] {}\n \t    incr np\n \t}\n     } else {\n \tforeach p $olds {\n-\t    append comment \"Parent: [commit_descriptor $p]\\n\"\n+\t    append headers \"Parent: [commit_descriptor $p]\\n\"\n \t}\n     }\n \n     foreach c [lindex $childlist $l] {\n-\tappend comment \"Child:  [commit_descriptor $c]\\n\"\n+\tappend headers \"Child:  [commit_descriptor $c]\\n\"\n     }\n-    append comment \"\\n\"\n-    append comment [lindex $info 5]\n \n     # make anything that looks like a SHA1 ID be a clickable link\n-    appendwithlinks $comment\n+    appendwithlinks $headers {}\n+    appendwithlinks [lindex $info 5] {comment}\n \n     $ctext tag delete Comments\n     $ctext tag remove found 1.0 end\n@@ -4504,7 +4505,7 @@ proc showtag {tag isnew} {\n     } else {\n \tset text \"Tag: $tag\\nId:  $tagids($tag)\"\n     }\n-    appendwithlinks $text\n+    appendwithlinks $text {}\n     $ctext conf -state disabled\n     init_flist {}\n }\n@@ -4890,6 +4891,7 @@ set downarrowlen 7\n set mingaplen 30\n set flistmode \"flat\"\n set cmitmode \"patch\"\n+set wrapcomment \"none\"\n \n set colors {green red blue magenta darkgrey brown orange}\n \n-- \n1.3.2.g10c1\n"}]}