From 5896579066b58a234e62895917746b2a707e76ad Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 17 Nov 2025 12:47:50 +1300 Subject: [PATCH] log_help.cc: Better line splitting If a word by itself meets the max line length it should only drop to a new line if the current line has content (would previously force an empty line before it). Include the length of indent when adding a line break (was previously only accounted for on the first line). --- kernel/log_help.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/log_help.cc b/kernel/log_help.cc index cb22d236e..3c22a80ac 100644 --- a/kernel/log_help.cc +++ b/kernel/log_help.cc @@ -84,6 +84,7 @@ void log_pass_str(const std::string &pass_str, std::string indent_str, bool lead std::istringstream iss(pass_str); if (leading_newline) log("\n"); + bool partial_line = false; for (std::string line; std::getline(iss, line);) { log("%s", indent_str); auto curr_len = indent_str.length(); @@ -91,13 +92,15 @@ void log_pass_str(const std::string &pass_str, std::string indent_str, bool lead for (std::string word; std::getline(lss, word, ' ');) { while (word[0] == '`' && word.back() == '`') word = word.substr(1, word.length()-2); - if (curr_len + word.length() >= MAX_LINE_LEN-1) { - curr_len = 0; + if (partial_line && curr_len + word.length() >= MAX_LINE_LEN-1) { + curr_len = indent_str.length(); log("\n%s", indent_str); + partial_line = false; } if (word.length()) { log("%s ", word); curr_len += word.length() + 1; + partial_line = true; } } log("\n");