mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 23:34:47 -05:00
fix(extensions/console): left align table entries (#11295)
This commit is contained in:
parent
e3a4e9cf11
commit
a8dcf9e261
2 changed files with 46 additions and 51 deletions
|
@ -79,7 +79,6 @@
|
|||
MapPrototypeForEach,
|
||||
Error,
|
||||
ErrorCaptureStackTrace,
|
||||
MathCeil,
|
||||
MathAbs,
|
||||
MathMax,
|
||||
MathMin,
|
||||
|
@ -192,12 +191,8 @@
|
|||
for (let i = 0; i < row.length; i++) {
|
||||
const cell = row[i];
|
||||
const len = getStringWidth(cell);
|
||||
const needed = (columnWidths[i] - len) / 2;
|
||||
// round(needed) + ceil(needed) will always add up to the amount
|
||||
// of spaces we need while also left justifying the output.
|
||||
out += `${StringPrototypeRepeat(" ", needed)}${cell}${
|
||||
StringPrototypeRepeat(" ", MathCeil(needed))
|
||||
}`;
|
||||
const needed = columnWidths[i] - len;
|
||||
out += `${cell}${StringPrototypeRepeat(" ", needed)}`;
|
||||
if (i !== row.length - 1) {
|
||||
out += tableChars.middle;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue