* [EGIT PATCH] Do not fill paragraphs in the commit message viewer after any sob.
@ 2009-04-13 23:26 Robin Rosenberg
0 siblings, 0 replies; only message in thread
From: Robin Rosenberg @ 2009-04-13 23:26 UTC (permalink / raw
To: spearce; +Cc: git, Robin Rosenberg
The fill-paragraph rules are ad-hoc and this seems like an improvement.
Sometimes we add strange extra tags after the sob lines, so don't
pretty-format these.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../ui/internal/history/CommitMessageViewer.java | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java
index d21555c..fc83782 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java
@@ -181,12 +181,18 @@ private void format() {
makeGrayText(d, styles);
d.append("\n");
String msg = commit.getFullMessage();
- if (fill)
- msg = msg.replaceAll("([\\w.; \t])\n(\\w)","$1 $2");
+ Pattern p = Pattern.compile("\n([A-Z](?:[A-Za-z]+-)+by: [^\n]+)");
+ if (fill) {
+ Matcher spm = p.matcher(msg);
+ if (spm.find()) {
+ String subMsg = msg.substring(0, spm.end());
+ msg = subMsg.replaceAll("([\\w.,; \t])\n(\\w)", "$1 $2")
+ + msg.substring(spm.end());
+ }
+ }
int h0 = d.length();
d.append(msg);
- Pattern p = Pattern.compile("\n([A-Z](?:[A-Za-z]+-)+by: [^\n]+)");
Matcher matcher = p.matcher(msg);
while (matcher.find()) {
styles.add(new StyleRange(h0 + matcher.start(), matcher.end()-matcher.start(), null, null, SWT.ITALIC));
--
1.6.2.2.446.gfbdc0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-13 23:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-13 23:26 [EGIT PATCH] Do not fill paragraphs in the commit message viewer after any sob Robin Rosenberg
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).