Fix formatting of commit message in Internet Explorer

Since commit 8ab61558d9 we are relying on
the CSS attribute 'white-space' being set to 'pre' to get proper line
breaks when formatting the commit message. The problem with this is
that in Internet Explorer 'white-space: pre' is not always working [1]
and as result the whole commit message appears in a single line.

To fix this, we are now not relying on 'white-space: pre' anymore but
we ensure the line breaks by replacing them with 'p' and 'br' html
elements as it was done before.

[1] http://www.quirksmode.org/css/quirksmode.html

Bug: issue 1517
Change-Id: I4915e4f6c3967dc88c564edbd38db6d9ce9c88dc
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2012-08-14 10:35:46 +02:00
committed by Keunhong Park
parent e0f21a5623
commit 1a6ff35cc0
2 changed files with 4 additions and 2 deletions

View File

@@ -104,6 +104,8 @@ public class CommitMessageBlock extends Composite {
SafeHtml commitBodyLinkified = new SafeHtmlBuilder().append(commitBody);
commitBodyLinkified = commitBodyLinkified.linkify();
commitBodyLinkified = CommentLinkProcessor.apply(commitBodyLinkified);
commitBodyLinkified = commitBodyLinkified.replaceAll("\n\n", "<p></p>");
commitBodyLinkified = commitBodyLinkified.replaceAll("\n", "<br />");
commitBodyPre.setInnerHTML(commitBodyLinkified.asString());
}
}