mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 00:38:08 +08:00
fix: restrict length of underline by size of line
in some cases, `region` contains several lines and `region::size` returns the whole size that is a sum of lengthes of all the lines. To avoid too long underlines, restrict the length of underline by the length of the line that is shown in the message.
This commit is contained in:
@@ -343,7 +343,8 @@ inline std::string format_underline(const std::string& message,
|
||||
{
|
||||
// invalid
|
||||
// ~~~~~~~
|
||||
retval << make_string(reg->size(), '~');
|
||||
const auto underline_len = std::min(reg->size(), reg->line().size());
|
||||
retval << make_string(underline_len, '~');
|
||||
}
|
||||
|
||||
retval << ' ';
|
||||
|
Reference in New Issue
Block a user