mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
Fix set of symbols [...] handling in the input line
This commit is contained in:
parent
2f82ea7e55
commit
b20f4d016b
11
btreeidx.cc
11
btreeidx.cc
|
@ -209,12 +209,15 @@ void BtreeWordSearchRequest::run()
|
|||
QRegExp regexp;
|
||||
bool useWildcards = allowMiddleMatches
|
||||
&& ( str.find( '*' ) != wstring::npos ||
|
||||
str.find( '?' ) != wstring::npos );
|
||||
str.find( '?' ) != wstring::npos ||
|
||||
str.find( '[' ) != wstring::npos ||
|
||||
str.find( ']' ) != wstring::npos);
|
||||
|
||||
wstring folded = Folding::apply( str );
|
||||
|
||||
if( useWildcards )
|
||||
{
|
||||
regexp.setPattern( gd::toQString( Folding::applyDiacriticsOnly( str ) ) );
|
||||
regexp.setPattern( gd::toQString( Folding::applyDiacriticsOnly( Folding::applySimpleCaseOnly( str ) ) ) );
|
||||
regexp.setPatternSyntax( QRegExp::WildcardUnix );
|
||||
regexp.setCaseSensitivity( Qt::CaseInsensitive );
|
||||
|
||||
|
@ -234,7 +237,7 @@ void BtreeWordSearchRequest::run()
|
|||
|
||||
if( bNoLetters )
|
||||
{
|
||||
if( ch == '*' || ch == '?' )
|
||||
if( ch == '*' || ch == '?' || ch == '[' || ch == ']' )
|
||||
{
|
||||
// Store escaped symbols
|
||||
wstring::size_type n = folded.size();
|
||||
|
@ -249,7 +252,7 @@ void BtreeWordSearchRequest::run()
|
|||
}
|
||||
else
|
||||
{
|
||||
if( ch == '\\' || ch == '*' || ch == '?' )
|
||||
if( ch == '\\' || ch == '*' || ch == '?' || ch == '[' || ch == ']' )
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,8 @@ wstring apply( wstring const & in, bool preserveWildcards )
|
|||
|
||||
if ( !isCombiningMark( ch ) && !isWhitespace( ch )
|
||||
&& ( !isPunct( ch )
|
||||
|| ( preserveWildcards && ( ch == '\\' || ch == '?' || ch == '*' ) )
|
||||
|| ( preserveWildcards &&
|
||||
( ch == '\\' || ch == '?' || ch == '*' || ch == '[' || ch == ']' ) )
|
||||
)
|
||||
)
|
||||
withoutDiacritics.push_back( ch );
|
||||
|
|
|
@ -854,7 +854,7 @@ void MainWindow::updateSearchPaneAndBar( bool searchInDock )
|
|||
translateBoxToolBarAction->setVisible( true );
|
||||
}
|
||||
|
||||
translateLine->setToolTip( tr( "String to search in dictionaries, the wildcards '*' and '?' are allowed.\nTo find '*' and '?' symbols use '\\*' and '\\?' respectively" ) );
|
||||
translateLine->setToolTip( tr( "String to search in dictionaries. The wildcards '*', '?' and sets of symbols '[...]' are allowed.\nTo find '*', '?', '[', ']' symbols use '\\*', '\\?', '\\[', '\\]' respectively" ) );
|
||||
|
||||
// reset the flag when switching UI modes
|
||||
wordListSelChanged = false;
|
||||
|
|
Loading…
Reference in a new issue