fix: highlight a rare case when toPlainText omit space between two words

This commit is contained in:
Xiao YiFang 2022-06-16 21:03:58 +08:00
parent 2da252539a
commit 1830415da5

View file

@ -2503,6 +2503,12 @@ void ArticleView::highlightFTSResults()
else else
regString = regString.remove( AccentMarkHandler::accentMark() ); regString = regString.remove( AccentMarkHandler::accentMark() );
//<div><i>watch</i>out</div> to plainText will return "watchout".
//if application goes here,that means the article text must contains the search text.
//whole word match regString will contain \b . can not match the above senario.
//workaround ,remove \b from the regstring="(\bwatch\b)"
regString.remove( QRegularExpression( "\\\\b" ) );
QRegularExpression regexp; QRegularExpression regexp;
if( Utils::Url::hasQueryItem( url, "wildcards" ) ) if( Utils::Url::hasQueryItem( url, "wildcards" ) )
regexp.setPattern( wildcardsToRegexp( regString ) ); regexp.setPattern( wildcardsToRegexp( regString ) );