X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e3c7fd79d081ccd02dc1a4ed601f4f1ea7b62e69..f7035880664b0989ba37df99956b556c322d50a7:/src/html/winpars.cpp diff --git a/src/html/winpars.cpp b/src/html/winpars.cpp index 66b8871b72..59b93e0692 100644 --- a/src/html/winpars.cpp +++ b/src/html/winpars.cpp @@ -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) { @@ -233,22 +234,32 @@ void wxHtmlWinParser::AddText(const wxChar* txt) { temp[templen-1] = wxT(' '); temp[templen] = 0; + if (templen == 1) continue; templen = 0; if (m_EncConv) m_EncConv->Convert(temp); - c = new wxHtmlWordCell(GetEntitiesParser()->Parse(temp), *(GetDC())); + size_t len = wxStrlen(temp); + for (size_t j = 0; j < len; j++) + if (temp[j] == nbsp) + temp[j] = wxT(' '); + c = new wxHtmlWordCell(temp, *(GetDC())); if (m_UseLink) c->SetLink(m_Link); m_Container->InsertCell(c); m_tmpLastWasSpace = TRUE; } } - if (templen) + + if (templen && (templen > 1 || temp[0] != wxT(' '))) { temp[templen] = 0; if (m_EncConv) m_EncConv->Convert(temp); - c = new wxHtmlWordCell(GetEntitiesParser()->Parse(temp), *(GetDC())); + size_t len = wxStrlen(temp); + for (size_t j = 0; j < len; j++) + if (temp[j] == nbsp) + temp[j] = wxT(' '); + c = new wxHtmlWordCell(temp, *(GetDC())); if (m_UseLink) c->SetLink(m_Link); m_Container->InsertCell(c);