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:
@@ -161,7 +161,7 @@ protected:
|
|||||||
virtual void AddText(const wxChar* txt);
|
virtual void AddText(const wxChar* txt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void FlushWordBuf(wxChar *temp, int& templen);
|
void FlushWordBuf(wxChar *temp, int& templen, wxChar nbsp);
|
||||||
void AddWord(wxHtmlWordCell *c);
|
void AddWord(wxHtmlWordCell *c);
|
||||||
void AddWord(const wxString& word);
|
void AddWord(const wxString& word);
|
||||||
void AddPreBlock(const wxString& text);
|
void AddPreBlock(const wxString& text);
|
||||||
|
@@ -496,7 +496,7 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
|
|||||||
while (i < lng)
|
while (i < lng)
|
||||||
{
|
{
|
||||||
x = 0;
|
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')))
|
if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t')))
|
||||||
{
|
{
|
||||||
i++, x++;
|
i++, x++;
|
||||||
@@ -505,22 +505,17 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
|
|||||||
}
|
}
|
||||||
else i++;
|
else i++;
|
||||||
|
|
||||||
if ( d == nbsp )
|
|
||||||
d = wxT(' ');
|
|
||||||
|
|
||||||
temp[templen++] = d;
|
|
||||||
|
|
||||||
if (x)
|
if (x)
|
||||||
{
|
{
|
||||||
temp[templen-1] = wxT(' ');
|
temp[templen-1] = wxT(' ');
|
||||||
FlushWordBuf(temp, templen);
|
FlushWordBuf(temp, templen, nbsp);
|
||||||
m_tmpLastWasSpace = true;
|
m_tmpLastWasSpace = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (templen && (templen > 1 || temp[0] != wxT(' ')))
|
if (templen && (templen > 1 || temp[0] != wxT(' ')))
|
||||||
{
|
{
|
||||||
FlushWordBuf(temp, templen);
|
FlushWordBuf(temp, templen, nbsp);
|
||||||
m_tmpLastWasSpace = false;
|
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;
|
buf[len] = 0;
|
||||||
|
|
||||||
|
for ( int i = 0; i < len; i++ )
|
||||||
|
{
|
||||||
|
if ( buf[i] == nbsp )
|
||||||
|
buf[i] = ' ';
|
||||||
|
}
|
||||||
|
|
||||||
#if !wxUSE_UNICODE
|
#if !wxUSE_UNICODE
|
||||||
if (m_EncConv)
|
if (m_EncConv)
|
||||||
m_EncConv->Convert(buf);
|
m_EncConv->Convert(buf);
|
||||||
|
Reference in New Issue
Block a user