fixed   handling in wxHtmlWinParser, broken by TAB-handling changes (bug #1957041)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@53457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2008-05-05 10:53:58 +00:00
parent af11165bd2
commit 0d00401fba
2 changed files with 11 additions and 10 deletions

View File

@@ -161,7 +161,7 @@ protected:
virtual void AddText(const wxChar* txt);
private:
void FlushWordBuf(wxChar *temp, int& templen);
void FlushWordBuf(wxChar *temp, int& templen, wxChar nbsp);
void AddWord(wxHtmlWordCell *c);
void AddWord(const wxString& word);
void AddPreBlock(const wxString& text);

View File

@@ -496,7 +496,7 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
while (i < lng)
{
x = 0;
wxChar d = txt[i];
const wxChar d = temp[templen++] = txt[i];
if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t')))
{
i++, x++;
@@ -505,22 +505,17 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
}
else i++;
if ( d == nbsp )
d = wxT(' ');
temp[templen++] = d;
if (x)
{
temp[templen-1] = wxT(' ');
FlushWordBuf(temp, templen);
FlushWordBuf(temp, templen, nbsp);
m_tmpLastWasSpace = true;
}
}
if (templen && (templen > 1 || temp[0] != wxT(' ')))
{
FlushWordBuf(temp, templen);
FlushWordBuf(temp, templen, nbsp);
m_tmpLastWasSpace = false;
}
}
@@ -547,10 +542,16 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
}
}
void wxHtmlWinParser::FlushWordBuf(wxChar *buf, int& len)
void wxHtmlWinParser::FlushWordBuf(wxChar *buf, int& len, wxChar nbsp)
{
buf[len] = 0;
for ( int i = 0; i < len; i++ )
{
if ( buf[i] == nbsp )
buf[i] = ' ';
}
#if !wxUSE_UNICODE
if (m_EncConv)
m_EncConv->Convert(buf);