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,
|
MapPrototypeForEach,
|
||||||
Error,
|
Error,
|
||||||
ErrorCaptureStackTrace,
|
ErrorCaptureStackTrace,
|
||||||
MathCeil,
|
|
||||||
MathAbs,
|
MathAbs,
|
||||||
MathMax,
|
MathMax,
|
||||||
MathMin,
|
MathMin,
|
||||||
|
@ -192,12 +191,8 @@
|
||||||
for (let i = 0; i < row.length; i++) {
|
for (let i = 0; i < row.length; i++) {
|
||||||
const cell = row[i];
|
const cell = row[i];
|
||||||
const len = getStringWidth(cell);
|
const len = getStringWidth(cell);
|
||||||
const needed = (columnWidths[i] - len) / 2;
|
const needed = columnWidths[i] - len;
|
||||||
// round(needed) + ceil(needed) will always add up to the amount
|
out += `${cell}${StringPrototypeRepeat(" ", needed)}`;
|
||||||
// of spaces we need while also left justifying the output.
|
|
||||||
out += `${StringPrototypeRepeat(" ", needed)}${cell}${
|
|
||||||
StringPrototypeRepeat(" ", MathCeil(needed))
|
|
||||||
}`;
|
|
||||||
if (i !== row.length - 1) {
|
if (i !== row.length - 1) {
|
||||||
out += tableChars.middle;
|
out += tableChars.middle;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue