Skip to content

Commit

Permalink
opt: beautify the layout of dictserver output
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Dec 7, 2024
1 parent 6ba04da commit 54a4bda
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/dict/dictserver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ class DictServerArticleRequest: public Dictionary::DataRequest
// proccess the line
QRegularExpression re( "^\\d{3} " );
uint32_t leadingSpaceCount = 0;
uint32_t firstLeadingSpaceCount = 0;
for ( const QString & line : lines ) {
//ignore 15X lines
if ( re.match( line ).hasMatch() ) {
Expand All @@ -618,8 +619,11 @@ class DictServerArticleRequest: public Dictionary::DataRequest

auto lsc = Utils::leadingSpaceCount( line );

if ( firstLeadingSpaceCount == 0 && lsc > firstLeadingSpaceCount ) {
firstLeadingSpaceCount = lsc;
}

if ( lsc >= leadingSpaceCount && lsc > 4 ) {
if ( lsc >= leadingSpaceCount && lsc > firstLeadingSpaceCount ) {
resultStr.append( line.trimmed() );
}
else {
Expand Down

0 comments on commit 54a4bda

Please sign in to comment.