diff --git a/src/common/utils.hh b/src/common/utils.hh index 6cff5ac53..15a4d35ee 100644 --- a/src/common/utils.hh +++ b/src/common/utils.hh @@ -45,7 +45,7 @@ inline uint32_t leadingSpaceCount( const QString & str ) if ( str.at( i ).isSpace() ) { continue; } - else{ + else { return i; } } diff --git a/src/dict/dictserver.cc b/src/dict/dictserver.cc index 9794ee980..9e05a88bb 100644 --- a/src/dict/dictserver.cc +++ b/src/dict/dictserver.cc @@ -599,35 +599,34 @@ class DictServerArticleRequest: public Dictionary::DataRequest } //modify the articleText,remove extra lines[start with 15X etc.] - QList lines = articleText.split("\n", Qt::SkipEmptyParts); + QList< QString > lines = articleText.split( "\n", Qt::SkipEmptyParts ); QStringList resultStr; // proccess the line - QRegularExpression re("^\\d{3} "); + QRegularExpression re( "^\\d{3} " ); uint32_t leadingSpaceCount = 0; for ( const QString & line : lines ) { //ignore 15X lines - if (re.match(line).hasMatch()) { - continue; - } - // ignore . endline - if(line.trimmed()=="."){ - break; - } - - auto lsc = Utils::leadingSpaceCount( line ); + if ( re.match( line ).hasMatch() ) { + continue; + } + // ignore . endline + if ( line.trimmed() == "." ) { + break; + } + auto lsc = Utils::leadingSpaceCount( line ); - if ( lsc >= leadingSpaceCount && lsc > 4 ) { - resultStr.append( line.trimmed() ); - } - else{ - resultStr.append( "\n" ); - resultStr.append( line ); - } - leadingSpaceCount = lsc; + if ( lsc >= leadingSpaceCount && lsc > 4 ) { + resultStr.append( line.trimmed() ); + } + else { + resultStr.append( "\n" ); + resultStr.append( line ); + } + leadingSpaceCount = lsc; } static QRegularExpression phonetic( R"(\\([^\\]+)\\)",