Catch2 icon indicating copy to clipboard operation
Catch2 copied to clipboard

Configure and disable word wrap in console reporter

Open rcdailey opened this issue 7 years ago • 9 comments

Right now the console reporter hard-codes the column width to 80 (default determined by Clara):

void printMessage() const {
    if (!messageLabel.empty())
        stream << messageLabel << ':' << '\n';
    for (auto const& msg : messages) {
        // If this assertion is a warning ignore any INFO messages
        if (printInfoMessages || msg.type != ResultWas::Info)
            stream << Column(msg.message).indent(2) << '\n';
    }
}

I'd like for each message to be printed with a custom column width, or no column width (disable word wrap). Is there a mechanism to do this right now? If not, what would be the best way to configure this? Looking for an ideal design approach and am happy to implement it.

@philsquared Please advise on your ideal design, I don't want to waste effort on a PR if I don't do things how you prefer them to be. Thanks.

rcdailey avatar Jul 26 '18 20:07 rcdailey

@philsquared: Would love to get your feedback on this. I know you're busy but hopefully you can spare a few minutes. Thanks!

rcdailey avatar Aug 02 '18 17:08 rcdailey

Has this been resolved? I have a specific use-case for which line-wrapping makes my error messages almost unreadable in some cases.

Time0o avatar Dec 08 '20 14:12 Time0o

This can be configured at compile time by #define CATCH_CONFIG_CONSOLE_WIDTH or CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH.

I don't see any option to do it at runtime, though.

jwdevel avatar Mar 11 '21 17:03 jwdevel

This would also be useful for me. My tests can output file names on failure, and word wrap breaks up those file names across multiple lines so I can no longer ctrl+click to open the file. My preference would be an easy way to turn off word wrapping entirely.

davidstone avatar Dec 03 '21 23:12 davidstone

I just spent 2 hours finding seemingly identical string diff in test failure because a space was lost due to line wrapping. would love to have line wrap disabled by default.

scarf005 avatar Oct 15 '23 13:10 scarf005

This would be great. I don't want my INFO messages to be broken and wrapped at a fixed value.

araujoarthur0 avatar Jan 05 '24 18:01 araujoarthur0