util: refactor inspecting long lines
Using the util.inspect
compact
mode set to something else than
true
resulted in breaking long lines in case the line would exceed
the breakLength
option and if it contained whitespace and or new
lines.
It turned out that this behavior was less useful than originally
expected and it is now changed to only break on line breaks if the
breakLength
option is exceeded for the inspected string. This should
be align better with the user expectation than the former behavior.
Fixes: https://github.com/nodejs/node/issues/27690
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines