Handle "^~" combination in dsl dictionaries

This commit is contained in:
Abs62 2012-11-26 23:16:10 +04:00
parent cc771ace77
commit af1403da2d
2 changed files with 13 additions and 3 deletions

2
dsl.cc
View file

@ -70,7 +70,7 @@ DEF_EX_STR( exCantReadFile, "Can't read file", Dictionary::Ex )
enum
{
Signature = 0x584c5344, // DSLX on little-endian, XLSD on big-endian
CurrentFormatVersion = 16 + BtreeIndexing::FormatVersion + Folding::Version,
CurrentFormatVersion = 17 + BtreeIndexing::FormatVersion + Folding::Version,
CurrentZipSupportVersion = 2
};

View file

@ -1049,8 +1049,18 @@ void expandTildes( wstring & str, wstring const & tildeReplacement )
else
if ( str[ x ] == L'~' )
{
str.replace( x, 1, tildeReplacement );
x += tildeReplacement.size();
if( x > 0 && str[ x - 1 ] == '^' && ( x < 2 || str[ x - 2 ] != '\\' ) )
{
str.replace( x - 1, 2, tildeReplacement );
str[ x - 1 ] = QChar( str[ x - 1 ] ).isUpper() ? QChar::toLower( str[ x - 1 ] )
: QChar::toUpper( str[ x - 1 ] );
x = x - 1 + tildeReplacement.size();
}
else
{
str.replace( x, 1, tildeReplacement );
x += tildeReplacement.size();
}
}
else
++x;