summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/internal/util/inspect.js3
-rw-r--r--test/parallel/test-util-inspect.js14
2 files changed, 8 insertions, 9 deletions
diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js
index ed68ebed16..b8f1c4f0af 100644
--- a/lib/internal/util/inspect.js
+++ b/lib/internal/util/inspect.js
@@ -997,7 +997,8 @@ function groupArrayElements(ctx, output, value) {
(totalLength / actualMax > 5 || maxLength <= 6)) {
const approxCharHeights = 2.5;
- const biasedMax = Math.max(actualMax - 4, 1);
+ const averageBias = Math.sqrt(actualMax - totalLength / output.length);
+ const biasedMax = Math.max(actualMax - 3 - averageBias, 1);
// Dynamically check how many columns seem possible.
const columns = Math.min(
// Ideally a square should be drawn. We expect a character to be about 2.5
diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js
index c264c409e5..e843cc49a8 100644
--- a/test/parallel/test-util-inspect.js
+++ b/test/parallel/test-util-inspect.js
@@ -2274,14 +2274,12 @@ assert.strictEqual(
expected = [
'[',
- ' 1, 1, 1,',
- ' 1, 1, 1,',
- ' 1, 1, 1,',
- ' 1, 1, 1,',
- ' 1, 1, 1,',
- ' 1, 1, 1,',
- ' 1, 1, 1,',
- ' 1, 1, 1,',
+ ' 1, 1, 1, 1,',
+ ' 1, 1, 1, 1,',
+ ' 1, 1, 1, 1,',
+ ' 1, 1, 1, 1,',
+ ' 1, 1, 1, 1,',
+ ' 1, 1, 1, 1,',
' 1, 1, 123456789',
']'
].join('\n');