+ int templen = 0;
+
+ size_t lng = txt.length();
+ if (lng+1 > m_tmpStrBufSize)
+ {
+ delete[] m_tmpStrBuf;
+ m_tmpStrBuf = new wxChar[lng+1];
+ m_tmpStrBufSize = lng+1;
+ }
+ wxChar *temp = m_tmpStrBuf;
+
+ wxString::const_iterator i = txt.begin();
+ const wxString::const_iterator end = txt.end();
+
+ if (m_tmpLastWasSpace)
+ {
+ while ( (i < end) &&
+ (*i == wxT('\n') || *i == wxT('\r') || *i == wxT(' ') ||
+ *i == wxT('\t')) )
+ {
+ ++i;
+ }
+ }
+
+ while (i < end)
+ {
+ size_t x = 0;
+ const wxChar d = temp[templen++] = *i;
+ if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t')))
+ {
+ ++i, ++x;
+ while ( (i < end) &&
+ (*i == wxT('\n') || *i == wxT('\r') ||
+ *i == wxT(' ') || *i == wxT('\t')) )
+ {
+ ++i;
+ ++x;
+ }
+ }
+ else
+ {
+ ++i;
+ }
+
+ if (x)
+ {
+ temp[templen-1] = wxT(' ');
+ FlushWordBuf(temp, templen);
+ m_tmpLastWasSpace = true;
+ }
+ }
+
+ if (templen && (templen > 1 || temp[0] != wxT(' ')))
+ {
+ FlushWordBuf(temp, templen);
+ m_tmpLastWasSpace = false;
+ }