Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cjk expand character can not be searched #2016

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/common/folding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ std::u32string apply( std::u32string const & in, bool preserveWildcards )
{
// remove diacritics (normalization), white space, punt,
auto temp = QString::fromStdU32String( in )
.normalized( QString::NormalizationForm_KD )
.remove( RX::markSpace )
.normalized( QString::NormalizationForm_KD )
.removeIf( [ preserveWildcards ]( const QChar & ch ) -> bool {
return ch.isPunct()
&& !( preserveWildcards && ( ch == '\\' || ch == '?' || ch == '*' || ch == '[' || ch == ']' ) );
Expand Down Expand Up @@ -155,8 +155,7 @@ std::u32string applyWhitespaceAndPunctOnly( std::u32string const & in )

bool isWhitespace( char32_t ch )
{
//invisible character should be treated as whitespace as well.
return QChar::isSpace( ch ) || !QChar::isPrint( ch );
return QChar::isSpace( ch );
}

bool isWhitespaceOrPunct( char32_t ch )
Expand Down
2 changes: 1 addition & 1 deletion src/common/globalregex.hh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const static QRegularExpression accentMark( R"(\p{M})", QRegularExpression::UseU
const static QRegularExpression markPuncSpace( R"([\p{M}\p{Z}\p{C}\p{P}])",
QRegularExpression::UseUnicodePropertiesOption );
//contain unicode space and mark.invisible
xiaoyifang marked this conversation as resolved.
Show resolved Hide resolved
const static QRegularExpression markSpace( R"([\p{M}\p{Z}\p{C}])", QRegularExpression::UseUnicodePropertiesOption );
const static QRegularExpression markSpace( R"([\p{M}\p{Z}])", QRegularExpression::UseUnicodePropertiesOption );

const static QRegularExpression whiteSpace( "\\s+" );

Expand Down
Loading