From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: spearce@spearce.org
Cc: git@vger.kernel.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [EGIT PATCH] Do not fill paragraphs in the commit message viewer after any sob.
Date: Tue, 14 Apr 2009 01:26:10 +0200 [thread overview]
Message-ID: <1239665170-24090-1-git-send-email-robin.rosenberg@dewire.com> (raw)
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
reply other threads:[~2009-04-13 23:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1239665170-24090-1-git-send-email-robin.rosenberg@dewire.com \
--to=robin.rosenberg@dewire.com \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).