]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for nbsp problem and minor parsing flow change
authorVáclav Slavík <vslavik@fastmail.fm>
Wed, 8 Aug 2001 23:19:02 +0000 (23:19 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Wed, 8 Aug 2001 23:19:02 +0000 (23:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11334 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/html/htmlpars.cpp
src/html/winpars.cpp

index 64054fc2d2f246bdf211e123bd3d607688c28cc0..57a7406d032463b5e827531475c00ff58fc023db 100644 (file)
@@ -271,8 +271,9 @@ void wxHtmlParser::DoParsing(int begin_pos, int end_pos)
              pieces[m_CurTextPiece].m_pos < m_CurTag->GetBeginPos()))
         {
             // Add text:
-            AddText(m_Source.Mid(pieces[m_CurTextPiece].m_pos,
-                                 pieces[m_CurTextPiece].m_lng));
+            AddText(GetEntitiesParser()->Parse(
+                       m_Source.Mid(pieces[m_CurTextPiece].m_pos,
+                                    pieces[m_CurTextPiece].m_lng)));
             begin_pos = pieces[m_CurTextPiece].m_pos +
                         pieces[m_CurTextPiece].m_lng;
             m_CurTextPiece++;
index 66b8871b72242a42ee03ae16bd083900668a945b..fc5ddff8153634f12edaadc755411a5117b42b5b 100644 (file)
@@ -201,6 +201,7 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
            lng = wxStrlen(txt);
     register wxChar d;
     int templen = 0;
+    wxChar nbsp = GetEntitiesParser()->GetCharForCode(160 /* nbsp */);
 
     if (lng+1 > m_tmpStrBufSize)
     {
@@ -236,7 +237,12 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
             templen = 0;
             if (m_EncConv)
                 m_EncConv->Convert(temp);
-            c = new wxHtmlWordCell(GetEntitiesParser()->Parse(temp), *(GetDC()));
+            wxString str = GetEntitiesParser()->Parse(temp);
+            size_t len = str.Len();
+            for (size_t j = 0; j < len; j++)
+                if (str.GetChar(j) == nbsp)
+                    str[j] = wxT(' ');
+            c = new wxHtmlWordCell(str, *(GetDC()));
             if (m_UseLink)
                 c->SetLink(m_Link);
             m_Container->InsertCell(c);
@@ -248,7 +254,12 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
         temp[templen] = 0;
         if (m_EncConv)
             m_EncConv->Convert(temp);
-        c = new wxHtmlWordCell(GetEntitiesParser()->Parse(temp), *(GetDC()));
+        wxString str = GetEntitiesParser()->Parse(temp);
+        size_t len = str.Len();
+        for (size_t j = 0; j < len; j++)
+            if (str.GetChar(j) == nbsp)
+                str[j] = wxT(' ');
+        c = new wxHtmlWordCell(str, *(GetDC()));
         if (m_UseLink)
             c->SetLink(m_Link);
         m_Container->InsertCell(c);