From 49948e3b80991516de4cc07fcca8b1d2f9355dd5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 21 Apr 2025 21:00:00 +1200 Subject: [PATCH] tidying --- src/tableprint.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/tableprint.cpp b/src/tableprint.cpp index e2a9069..7cb9c22 100644 --- a/src/tableprint.cpp +++ b/src/tableprint.cpp @@ -46,18 +46,24 @@ void tableprint::print() { std::wcout << std::wstring(padding, L' ') << std::wstring(title.begin(), title.end()) << std::wstring(total_width - title.length() - padding, L' '); std::wcout << L"\033[90m│" << std::endl; - std::wcout << L"└" << std::wstring(total_width, L'─') << L"┘" << std::endl; + // Use └─┴─┘ for bottom of title box to connect with table + std::wcout << L"├"; + for (size_t i = 0; i < rows[0].size(); ++i) { + std::wcout << std::wstring(col_widths[i] + 2, L'─'); + if (i < rows[0].size() - 1) std::wcout << L"┬"; + } + std::wcout << L"┤" << std::endl; + } else { + // Print top border if no title + std::wcout << L"\033[90m"; // Dark grey color for borders + std::wcout << L"┌"; + for (size_t i = 0; i < rows[0].size(); ++i) { + std::wcout << std::wstring(col_widths[i] + 2, L'─'); + if (i < rows[0].size() - 1) std::wcout << L"┬"; + } + std::wcout << L"┐" << std::endl; } - // Print top border - std::wcout << L"\033[90m"; // Dark grey color for borders - std::wcout << L"┌"; - for (size_t i = 0; i < rows[0].size(); ++i) { - std::wcout << std::wstring(col_widths[i] + 2, L'─'); - if (i < rows[0].size() - 1) std::wcout << L"┬"; - } - std::wcout << L"┐" << std::endl; - // Print header std::wcout << L"│"; std::wcout << L"\033[1;36m"; // Cyan color for header