From 1921771bbdae49cd6905823d438d282059da5999 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Wed, 18 Jan 2023 20:25:03 +0300 Subject: [PATCH] Remove 0xAD symbol (soft hyphen) for popup window search --- config.cc | 2 +- mouseover.cc | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config.cc b/config.cc index e0e6f1b7..81c5d936 100644 --- a/config.cc +++ b/config.cc @@ -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. diff --git a/mouseover.cc b/mouseover.cc index 53c20f7d..3bec10c0 100644 --- a/mouseover.cc +++ b/mouseover.cc @@ -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 );