From d050c6b137199666cae75c2628a75d63b49b1c22 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Mon, 23 Sep 2024 13:44:01 +0000 Subject: [PATCH] feat [skip ci]: update single_include --- single_include/toml.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/single_include/toml.hpp b/single_include/toml.hpp index afdaf5b5..2c2ab37e 100644 --- a/single_include/toml.hpp +++ b/single_include/toml.hpp @@ -5323,7 +5323,9 @@ TOML11_INLINE std::ostringstream& format_underline(std::ostringstream& oss, oss << make_string(lnw + 1, ' ') << color::bold << color::blue << " | " << color::reset; - oss << make_string(col-1 /*1-origin*/, ' ') + // in case col is 0, so we don't create a string with size_t max length + const std::size_t sanitized_col = col == 0 ? 0 : col - 1 /*1-origin*/; + oss << make_string(sanitized_col, ' ') << color::bold << color::red << make_string(len, '^') << "-- " << color::reset << msg << '\n';