acutest icon indicating copy to clipboard operation
acutest copied to clipboard

Make the output adapt to terminal size

Open mity opened this issue 5 years ago • 2 comments

Make the output, especially as generated by the macros TEST_CHECK(), TEST_MSG() and TEST_DUMP(), automatically adapt to the current terminal size, so that it looks good in a reasonably small terminal window but can use effectively more space if the terminal window is big.

This should involve:

  1. Explore what API is available for the purpose on the platform of your choice.
  2. A pre-processor magic to enable the new platform-specific code only on the given platform.
  3. Breaking the long outputs into multiple lines, depending on the width of the terminal.
  4. And still respect the current indentation level, as set via test_line_indent__().

mity avatar Jan 11 '20 00:01 mity

I think this is mostly getenv("COLUMNS") and set a handler for SIGWINCH?

arr2036 avatar Feb 01 '20 01:02 arr2036

Actually, so far I never did anything like that. But yes, I think so. For Unix/Posix platforms, at least.

I am also not sure whether tracking SIGWINCH is worth the added complexity for something of Acutest's nature. Reading $COLUMNS during initialization might be good enough.

mity avatar Feb 01 '20 01:02 mity