From c784a23b6208d1c845bc08c271d7497faced5df2 Mon Sep 17 00:00:00 2001 From: fukusuket <41001169+fukusuket@users.noreply.github.com.> Date: Mon, 12 Aug 2024 16:20:54 +0900 Subject: [PATCH] fix: when there are 4 authors, set div to 1. --- src/afterfact.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/afterfact.rs b/src/afterfact.rs index 37541b5ea..2952ead93 100644 --- a/src/afterfact.rs +++ b/src/afterfact.rs @@ -2103,12 +2103,14 @@ fn output_detected_rule_authors( let mut sorted_authors: Vec<(&CompactString, &i128)> = rule_author_counter.iter().collect(); sorted_authors.sort_by(|a, b| (-a.1).cmp(&(-b.1))); - let div = if sorted_authors.len() % 4 != 0 { - sorted_authors.len() / table_column_num + 1 + let authors_num = sorted_authors.len(); + let div = if authors_num <= table_column_num { + 1 + } else if authors_num % 4 != 0 { + authors_num / table_column_num + 1 } else { - sorted_authors.len() / table_column_num + authors_num / table_column_num }; - let mut tb = Table::new(); tb.load_preset(UTF8_FULL) .apply_modifier(UTF8_ROUND_CORNERS)