Firstly, I do not familiar with wxsmith's source code, but I do see an issue:
wxString wxsCoder::RebuildCode(wxString& BaseIndentation,const wxChar* Code,int CodeLen,wxString& EOL)
{
wxString Tab;
bool UseTab = Manager::Get()->GetConfigManager(_T("editor"))->ReadBool(_T("/use_tab"), false);
int TabSize = Manager::Get()->GetConfigManager(_T("editor"))->ReadInt(_T("/tab_size"), 4);
if ( !UseTab )
{
Tab.Append(_T(' '),TabSize);
}
if ( EOL.IsEmpty() )
{
int EolMode = Manager::Get()->GetConfigManager(_T("editor"))->ReadInt(_T("/eol/eolmode"), 0);
switch ( EolMode )
{
case 1: EOL = _T("\r"); break;
case 2: EOL = _T("\n"); break;
default: EOL = _T("\r\n");
}
}
BaseIndentation.Prepend(EOL);
wxString Result;
Result.reserve(CodeLen+10);
while ( *Code )
{
switch ( *Code )
{
case _T('\n'):
{
while (Result.Last() == _T(' ') || Result.Last() == _T('\t'))
Result.RemoveLast();
Result << BaseIndentation;
break;
}
case _T('\t'): if ( UseTab ) { Result << Tab; break; }
default: Result << *Code;
}
Code++;
}
return Result;
}
The Value "Tab" is either "empty string" or "four spaces".
There is something wrong with the line:
case _T('\t'): if ( UseTab ) { Result << Tab; break; }
I think it should be:
case _T('\t'): if ( !UseTab ) { Result << Tab; break; }
Otherwise, the '\t' is always added to the code, right?