Remove 0xAD symbol (soft hyphen) for popup window search

This commit is contained in:
Abs62 2023-01-18 20:25:03 +03:00
parent 46a34e805c
commit 1921771bbd
2 changed files with 6 additions and 6 deletions

View file

@ -193,7 +193,7 @@ InputPhrase Preferences::sanitizeInputPhrase( QString const & inputPhrase ) cons
return result;
}
const QString withPunct = inputPhrase.simplified();
const QString withPunct = inputPhrase.simplified().remove( QChar( 0xAD ) ); // Simplify whitespaces and remove soft hyphens
result.phrase = gd::toQString( Folding::trimWhitespaceOrPunct( gd::toWString( withPunct ) ) );
if ( !result.isValid() )
return result; // The suffix of an invalid input phrase must be empty.

View file

@ -294,7 +294,7 @@ LRESULT CALLBACK MouseOver::eventHandler( HWND hwnd_, UINT msg,
return 0;
}
else
if ( !wordSeq[ wordSeqPos ].isLetterOrNumber() )
if ( !( wordSeq[ wordSeqPos ].isLetterOrNumber() || wordSeq[ wordSeqPos ] == QChar( 0xAD ) ) ) // Assume soft hyphen as letter
{
// Special case: the cursor points to something which doesn't look like a
// middle of the word -- assume that it's something that joins two words
@ -303,13 +303,13 @@ LRESULT CALLBACK MouseOver::eventHandler( HWND hwnd_, UINT msg,
int begin = wordSeqPos;
for( ; begin; --begin )
if ( !wordSeq[ begin - 1 ].isLetterOrNumber() )
if ( !( wordSeq[ begin - 1 ].isLetterOrNumber() || wordSeq[ begin - 1 ] == QChar( 0xAD ) ) )
break;
int end = wordSeqPos;
while( ++end < wordSeq.size() )
if ( !wordSeq[ end ].isLetterOrNumber() )
if ( !( wordSeq[ end ].isLetterOrNumber() || wordSeq[ end ] == QChar( 0xAD ) ) )
break;
if ( end - begin == 1 )
@ -327,14 +327,14 @@ LRESULT CALLBACK MouseOver::eventHandler( HWND hwnd_, UINT msg,
int begin = wordSeqPos;
for( ; begin; --begin )
if ( !wordSeq[ begin - 1 ].isLetterOrNumber() )
if ( !( wordSeq[ begin - 1 ].isLetterOrNumber() || wordSeq[ begin - 1 ] == QChar( 0xAD ) ) )
break;
int end = wordSeqPos;
while( ++end < wordSeq.size() )
{
if ( !wordSeq[ end ].isLetterOrNumber() )
if ( !( wordSeq[ end ].isLetterOrNumber() || wordSeq[ end ] == QChar( 0xAD ) ) )
break;
}
word = wordSeq.mid( begin, end - begin );