X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7bf6f523e7a41c094765bd5dc42da71342e5e32c..4b5e178a4c22caac92952131632641c63821fc0c:/src/html/m_pre.cpp 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;