Git development
 help / color / mirror / Atom feed
* [PATCH] gitk: Display commit messages with word wrap
@ 2006-05-14 15:14 Sergey Vlasov
  2006-05-14 23:30 ` Junio C Hamano
  2006-05-14 23:34 ` Paul Mackerras
  0 siblings, 2 replies; 6+ messages in thread
From: Sergey Vlasov @ 2006-05-14 15:14 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git

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.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>


---

 gitk |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

be428b9cd6287b214e61c614bd4c4b4fa3d20075
diff --git a/gitk b/gitk
index 4aa57c0..41f25df 100755
--- a/gitk
+++ b/gitk
@@ -527,6 +527,7 @@ proc makewindow {} {
     pack $ctext -side left -fill both -expand 1
     .ctop.cdet add .ctop.cdet.left
 
+    $ctext tag conf comment -wrap word
     $ctext tag conf filesep -font [concat $textfont bold] -back "#aaaaaa"
     $ctext tag conf hunksep -fore blue
     $ctext tag conf d0 -fore red
@@ -3222,12 +3223,12 @@ proc commit_descriptor {p} {
 
 # append some text to the ctext widget, and make any SHA1 ID
 # that we know about be a clickable link.
-proc appendwithlinks {text} {
+proc appendwithlinks {text tags} {
     global ctext commitrow linknum curview
 
     set start [$ctext index "end - 1c"]
-    $ctext insert end $text
-    $ctext insert end "\n"
+    $ctext insert end $text $tags
+    $ctext insert end "\n" {}
     set links [regexp -indices -all -inline {[0-9a-f]{40}} $text]
     foreach l $links {
 	set s [lindex $l 0]
@@ -3354,7 +3355,7 @@ proc selectline {l isnew} {
 	$ctext insert end "\n"
     }
  
-    set comment {}
+    set headers {}
     set olds [lindex $parentlist $l]
     if {[llength $olds] > 1} {
 	set np 0
@@ -3365,23 +3366,22 @@ proc selectline {l isnew} {
 		set tag m$np
 	    }
 	    $ctext insert end "Parent: " $tag
-	    appendwithlinks [commit_descriptor $p]
+	    appendwithlinks [commit_descriptor $p] {}
 	    incr np
 	}
     } else {
 	foreach p $olds {
-	    append comment "Parent: [commit_descriptor $p]\n"
+	    append headers "Parent: [commit_descriptor $p]\n"
 	}
     }
 
     foreach c [lindex $childlist $l] {
-	append comment "Child:  [commit_descriptor $c]\n"
+	append headers "Child:  [commit_descriptor $c]\n"
     }
-    append comment "\n"
-    append comment [lindex $info 5]
 
     # make anything that looks like a SHA1 ID be a clickable link
-    appendwithlinks $comment
+    appendwithlinks $headers {}
+    appendwithlinks [lindex $info 5] {comment}
 
     $ctext tag delete Comments
     $ctext tag remove found 1.0 end
@@ -4504,7 +4504,7 @@ proc showtag {tag isnew} {
     } else {
 	set text "Tag: $tag\nId:  $tagids($tag)"
     }
-    appendwithlinks $text
+    appendwithlinks $text {}
     $ctext conf -state disabled
     init_flist {}
 }
-- 
1.3.2.g8252

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] gitk: Display commit messages with word wrap
  2006-05-14 15:14 [PATCH] gitk: Display commit messages with word wrap Sergey Vlasov
@ 2006-05-14 23:30 ` Junio C Hamano
  2006-05-15 15:07   ` Sergey Vlasov
  2006-05-14 23:34 ` Paul Mackerras
  1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2006-05-14 23:30 UTC (permalink / raw)
  To: Sergey Vlasov; +Cc: git

Sergey Vlasov <vsu@altlinux.ru> writes:

> 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.

I do not mind it myself but IIRC gitk's "no wrapping" was made
because people found wrapping annoying; maybe a runtime
configuration option?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gitk: Display commit messages with word wrap
  2006-05-14 15:14 [PATCH] gitk: Display commit messages with word wrap Sergey Vlasov
  2006-05-14 23:30 ` Junio C Hamano
@ 2006-05-14 23:34 ` Paul Mackerras
  2006-05-15 15:06   ` Sergey Vlasov
  2006-05-15 15:13   ` [PATCH] gitk: Display commit messages with word wrap (try 2) Sergey Vlasov
  1 sibling, 2 replies; 6+ messages in thread
From: Paul Mackerras @ 2006-05-14 23:34 UTC (permalink / raw)
  To: Sergey Vlasov; +Cc: git

Sergey Vlasov writes:

> 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.

Well... you can scroll in any direction with mouse button 2, but ok...

> +    $ctext insert end "\n" {}

Why are you adding the superfluous {} ?

> -    set comment {}
> +    set headers {}

Why are you changing the name here?  Your commit description doesn't
address either of these points.

Paul.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gitk: Display commit messages with word wrap
  2006-05-14 23:34 ` Paul Mackerras
@ 2006-05-15 15:06   ` Sergey Vlasov
  2006-05-15 15:13   ` [PATCH] gitk: Display commit messages with word wrap (try 2) Sergey Vlasov
  1 sibling, 0 replies; 6+ messages in thread
From: Sergey Vlasov @ 2006-05-15 15:06 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]

On Mon, May 15, 2006 at 09:34:05AM +1000, Paul Mackerras wrote:
> Sergey Vlasov writes:
> 
> > 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.
> 
> Well... you can scroll in any direction with mouse button 2, but ok...

I completely forgot about this obscure feature of Tk (and is it only me
who thinks that it scrolls in the wrong direction?).

> > +    $ctext insert end "\n" {}
> 
> Why are you adding the superfluous {} ?

Because I was paranoid about not letting the tag leak into subsequent
text...  but apparently this does not happen even without that {}, so I'll
remove it.

> > -    set comment {}
> > +    set headers {}
> 
> Why are you changing the name here?  Your commit description doesn't
> address either of these points.

Previously the "comment" variable contained both the commit headers
("Parent:" and "Child:" lines) and the commit message, and all this text
was inserted into $ctext by a single call to "appendwithlinks".  Now I
need to insert these parts separately (wrapped "Parent:" and "Child:"
lines look bad, I want to wrap only the commit message), therefore only
headers are collected in that variable - so I renamed it to reflect this
new usage.

I'll send the updated patch in a separate message.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gitk: Display commit messages with word wrap
  2006-05-14 23:30 ` Junio C Hamano
@ 2006-05-15 15:07   ` Sergey Vlasov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergey Vlasov @ 2006-05-15 15:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

On Sun, May 14, 2006 at 04:30:50PM -0700, Junio C Hamano wrote:
> Sergey Vlasov <vsu@altlinux.ru> writes:
> 
> > 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.
> 
> I do not mind it myself but IIRC gitk's "no wrapping" was made
> because people found wrapping annoying; maybe a runtime
> configuration option?

OK, added a hidden option in ~/.gitk which defaults to "no wrapping", so
most users will not notice anything...

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] gitk: Display commit messages with word wrap (try 2)
  2006-05-14 23:34 ` Paul Mackerras
  2006-05-15 15:06   ` Sergey Vlasov
@ 2006-05-15 15:13   ` Sergey Vlasov
  1 sibling, 0 replies; 6+ messages in thread
From: Sergey Vlasov @ 2006-05-15 15:13 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git

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>

---

 gitk |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

 The text about the "comment" variable IMHO just does not fit in the
 commit message above - if you prefer, I'll just make two separate
 patches, the first which leaves the "comment" name in place (ignoring the
 fact that the variable is no longer holding the comment text), and the
 second which just renames it to "headers".

f23c00577c9a4379c794313f8e54132a159f7f43
diff --git a/gitk b/gitk
index 4aa57c0..8d046af 100755
--- a/gitk
+++ b/gitk
@@ -380,7 +380,7 @@ proc makewindow {} {
     global findtype findtypemenu findloc findstring fstring geometry
     global entries sha1entry sha1string sha1but
     global maincursor textcursor curtextcursor
-    global rowctxmenu mergemax
+    global rowctxmenu mergemax wrapcomment
 
     menu .bar
     .bar add cascade -label "File" -menu .bar.file
@@ -527,6 +527,7 @@ proc makewindow {} {
     pack $ctext -side left -fill both -expand 1
     .ctop.cdet add .ctop.cdet.left
 
+    $ctext tag conf comment -wrap $wrapcomment
     $ctext tag conf filesep -font [concat $textfont bold] -back "#aaaaaa"
     $ctext tag conf hunksep -fore blue
     $ctext tag conf d0 -fore red
@@ -696,7 +697,7 @@ proc savestuff {w} {
     global stuffsaved findmergefiles maxgraphpct
     global maxwidth
     global viewname viewfiles viewargs viewperm nextviewnum
-    global cmitmode
+    global cmitmode wrapcomment
 
     if {$stuffsaved} return
     if {![winfo viewable .]} return
@@ -709,6 +710,7 @@ proc savestuff {w} {
 	puts $f [list set maxgraphpct $maxgraphpct]
 	puts $f [list set maxwidth $maxwidth]
 	puts $f [list set cmitmode $cmitmode]
+	puts $f [list set wrapcomment $wrapcomment]
 	puts $f "set geometry(width) [winfo width .ctop]"
 	puts $f "set geometry(height) [winfo height .ctop]"
 	puts $f "set geometry(canv1) [expr {[winfo width $canv]-2}]"
@@ -3222,11 +3224,11 @@ proc commit_descriptor {p} {
 
 # append some text to the ctext widget, and make any SHA1 ID
 # that we know about be a clickable link.
-proc appendwithlinks {text} {
+proc appendwithlinks {text tags} {
     global ctext commitrow linknum curview
 
     set start [$ctext index "end - 1c"]
-    $ctext insert end $text
+    $ctext insert end $text $tags
     $ctext insert end "\n"
     set links [regexp -indices -all -inline {[0-9a-f]{40}} $text]
     foreach l $links {
@@ -3354,7 +3356,7 @@ proc selectline {l isnew} {
 	$ctext insert end "\n"
     }
  
-    set comment {}
+    set headers {}
     set olds [lindex $parentlist $l]
     if {[llength $olds] > 1} {
 	set np 0
@@ -3365,23 +3367,22 @@ proc selectline {l isnew} {
 		set tag m$np
 	    }
 	    $ctext insert end "Parent: " $tag
-	    appendwithlinks [commit_descriptor $p]
+	    appendwithlinks [commit_descriptor $p] {}
 	    incr np
 	}
     } else {
 	foreach p $olds {
-	    append comment "Parent: [commit_descriptor $p]\n"
+	    append headers "Parent: [commit_descriptor $p]\n"
 	}
     }
 
     foreach c [lindex $childlist $l] {
-	append comment "Child:  [commit_descriptor $c]\n"
+	append headers "Child:  [commit_descriptor $c]\n"
     }
-    append comment "\n"
-    append comment [lindex $info 5]
 
     # make anything that looks like a SHA1 ID be a clickable link
-    appendwithlinks $comment
+    appendwithlinks $headers {}
+    appendwithlinks [lindex $info 5] {comment}
 
     $ctext tag delete Comments
     $ctext tag remove found 1.0 end
@@ -4504,7 +4505,7 @@ proc showtag {tag isnew} {
     } else {
 	set text "Tag: $tag\nId:  $tagids($tag)"
     }
-    appendwithlinks $text
+    appendwithlinks $text {}
     $ctext conf -state disabled
     init_flist {}
 }
@@ -4890,6 +4891,7 @@ set downarrowlen 7
 set mingaplen 30
 set flistmode "flat"
 set cmitmode "patch"
+set wrapcomment "none"
 
 set colors {green red blue magenta darkgrey brown orange}
 
-- 
1.3.2.g10c1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-05-15 15:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-14 15:14 [PATCH] gitk: Display commit messages with word wrap Sergey Vlasov
2006-05-14 23:30 ` Junio C Hamano
2006-05-15 15:07   ` Sergey Vlasov
2006-05-14 23:34 ` Paul Mackerras
2006-05-15 15:06   ` Sergey Vlasov
2006-05-15 15:13   ` [PATCH] gitk: Display commit messages with word wrap (try 2) Sergey Vlasov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox