diff --git a/src/catch2/reporters/catch_reporter_console.cpp b/src/catch2/reporters/catch_reporter_console.cpp index bbde5ec9..b5f3045d 100644 --- a/src/catch2/reporters/catch_reporter_console.cpp +++ b/src/catch2/reporters/catch_reporter_console.cpp @@ -297,7 +297,7 @@ class TablePrinter { std::ostream& m_os; std::vector m_columnInfos; ReusableStringStream m_oss; - int m_currentColumn = -1; + std::size_t m_currentColumn = 0; bool m_isOpen = false; public: @@ -345,11 +345,10 @@ public: const auto strSize = colStr.size(); tp.m_oss.str(""); tp.open(); - if (tp.m_currentColumn == static_cast(tp.m_columnInfos.size() - 1)) { - tp.m_currentColumn = -1; + if (tp.m_currentColumn == tp.m_columnInfos.size()) { + tp.m_currentColumn = 0; tp.m_os << '\n'; } - tp.m_currentColumn++; auto colInfo = tp.m_columnInfos[tp.m_currentColumn]; auto padding = (strSize + 1 < colInfo.width) @@ -365,7 +364,7 @@ public: friend TablePrinter& operator<< (TablePrinter& tp, RowBreak) { if (tp.m_currentColumn > 0) { tp.m_os << '\n'; - tp.m_currentColumn = -1; + tp.m_currentColumn = 0; } return tp; }