From f290390c630fa66713e0bcc35a3ee082134236b9 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Wed, 13 Nov 2019 18:14:42 +0900 Subject: [PATCH] fix: consider the no-space cases like [error]: --- toml/region.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/toml/region.hpp b/toml/region.hpp index 8169342..b6ba119 100644 --- a/toml/region.hpp +++ b/toml/region.hpp @@ -441,13 +441,13 @@ inline std::string format_underline(const std::string& message, } // XXX - // Here, before `colorize` support, it does not output `[error] ` prefix + // Here, before `colorize` support, it does not output `[error]` prefix // automatically. So some user may output it manually and this change may - // duplicate the prefix. To avoid it, check the first 8 characters and - // if it is "[error] ", it removes that part from the message shown. - if(message.size() > 8 && message.substr(0, 8) == "[error] ") + // duplicate the prefix. To avoid it, check the first 7 characters and + // if it is "[error]", it removes that part from the message shown. + if(message.size() > 7 && message.substr(0, 7) == "[error]") { - retval << color::bold << color::red << "[error] " << color::reset + retval << color::bold << color::red << "[error]" << color::reset << color::bold << message.substr(8) << color::reset << '\n'; } else