From 02bfa0898c84611f79d179c365746357e7f369a4 Mon Sep 17 00:00:00 2001 From: ngugcx Date: Sun, 15 Mar 2020 20:09:28 +0800 Subject: [PATCH] Do not fill blanks to align if there is only one line. --- include/spdlog/fmt/bin_to_hex.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/spdlog/fmt/bin_to_hex.h b/include/spdlog/fmt/bin_to_hex.h index ed661ba4..7e65ae91 100644 --- a/include/spdlog/fmt/bin_to_hex.h +++ b/include/spdlog/fmt/bin_to_hex.h @@ -177,14 +177,17 @@ struct formatter> } if (show_ascii) { - auto blank_num = size_per_line - (the_range.end() - start_of_line); - while (blank_num-- > 0) + if (the_range.end() - the_range.begin() > size_per_line) { - *inserter++ = ' '; - *inserter++ = ' '; - if (put_delimiters) + auto blank_num = size_per_line - (the_range.end() - start_of_line); + while (blank_num-- > 0) { *inserter++ = ' '; + *inserter++ = ' '; + if (put_delimiters) + { + *inserter++ = ' '; + } } } *inserter++ = ' ';