From 05fbc682d63a1f4ac17ecbeae3de5e3067d863a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Tue, 28 Oct 2008 10:06:32 +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/branches/WX_2_8_BRANCH@56547 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/changes.txt   |  1 +
 src/html/m_pre.cpp | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/docs/changes.txt b/docs/changes.txt
index 3f3f8ad100..bfda87fa83 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -102,6 +102,7 @@ All (GUI):
   Polish Pro input.
 - Fixed wxHtmlWindow::SelectionToText() to correctly insert newlines after
   single-cell paragraphs.
+- Fixed wxHTML's line breaks handling in 
 blocks broken in 2.8.8 (#10120)
 
 All (Unix):
 
diff --git a/src/html/m_pre.cpp b/src/html/m_pre.cpp
index 354e585384..0c20222a7c 100644
--- a/src/html/m_pre.cpp
+++ b/src/html/m_pre.cpp
@@ -46,9 +46,22 @@ static wxString LINKAGEMODE HtmlizeLinebreaks(const wxString& str)
                 }
                 out << wxT('>');
                 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 wxT('\r'): + { + size_t j = i + 1; + if ( j < len && str[j] == wxT('\n') ) + i = j; + } + // fall through case wxT('\n'): out << wxT("
"); break; + default: out << str[i]; break;