From 9e570f836b9d7786787a4d1ef0c3651bef11b559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Tue, 28 Oct 2008 10:04:36 +0000 Subject: [PATCH] fixed interpretation of line breaks in
 to conform to
 the spec (#10120)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56546 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/html/m_pre.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/html/m_pre.cpp b/src/html/m_pre.cpp
index c4a33f8c82..1a0ef36813 100644
--- a/src/html/m_pre.cpp
+++ b/src/html/m_pre.cpp
@@ -47,9 +47,22 @@ static wxString LINKAGEMODE HtmlizeLinebreaks(const wxString& str)
                 if ( i == end )
                     return out;
                 break;
+
+            // We need to translate any line break into exactly one 
. + // Quoting HTML spec: "A line break is defined to be a carriage + // return ( ), a line feed ( ), or a carriage + // return/line feed pair." + case '\r': + { + wxString::const_iterator j(i + 1); + if ( j != end && *j == '\n' ) + i = j; + } + // fall through case '\n': out << "
"; break; + default: out << *i; break;