fix for nbsp problem and minor parsing flow change

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11334 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2001-08-08 23:19:02 +00:00
parent 61b50a43aa
commit f23e92e72a
2 changed files with 16 additions and 4 deletions

View 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++;

View 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);