Skip to content

Commit

Permalink
util: add todo comments for inspect to add unicode support
Browse files Browse the repository at this point in the history
PR-URL: #31112
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
BridgeAR authored and targos committed Apr 28, 2020
1 parent 5e5d053 commit a0b1a06
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/internal/util/inspect.js
Expand Up @@ -1206,6 +1206,8 @@ function groupArrayElements(ctx, output, value) {
if (columns <= 1) {
return output;
}
// TODO(BridgeAR): Add unicode support. Use the readline getStringWidth
// function.
const tmp = [];
const maxLineLength = [];
for (let i = 0; i < columns; i++) {
Expand Down Expand Up @@ -1283,6 +1285,8 @@ function formatBigInt(fn, value) {
function formatPrimitive(fn, value, ctx) {
if (typeof value === 'string') {
if (ctx.compact !== true &&
// TODO(BridgeAR): Add unicode support. Use the readline getStringWidth
// function.
value.length > kMinLineLength &&
value.length > ctx.breakLength - ctx.indentationLvl - 4) {
return value
Expand Down Expand Up @@ -1636,6 +1640,9 @@ function isBelowBreakLength(ctx, output, start, base) {
// Each entry is separated by at least a comma. Thus, we start with a total
// length of at least `output.length`. In addition, some cases have a
// whitespace in-between each other that is added to the total as well.
// TODO(BridgeAR): Add unicode support. Use the readline getStringWidth
// function. Check the performance overhead and make it an opt-in in case it's
// significant.
let totalLength = output.length + start;
if (totalLength + output.length > ctx.breakLength)
return false;
Expand Down

0 comments on commit a0b1a06

Please sign in to comment.