Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Dec 7, 2024
1 parent 647a353 commit 6ba04da
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/common/utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ inline uint32_t leadingSpaceCount( const QString & str )
if ( str.at( i ).isSpace() ) {
continue;
}
else{
else {
return i;
}
}
Expand Down
37 changes: 18 additions & 19 deletions src/dict/dictserver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -599,35 +599,34 @@ class DictServerArticleRequest: public Dictionary::DataRequest
}

//modify the articleText,remove extra lines[start with 15X etc.]
QList<QString> 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"(\\([^\\]+)\\)",
Expand Down

0 comments on commit 6ba04da

Please sign in to comment.