@oclif/table 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/table.js +3 -3
  2. package/package.json +1 -1
package/lib/table.js CHANGED
@@ -59,7 +59,7 @@ function determineTruncatePosition(overflow) {
59
59
  }
60
60
  }
61
61
  }
62
- function doStuffWithText({ horizontalAlignment, overflow, padding, value, width, }) {
62
+ function formatTextWithMargins({ horizontalAlignment, overflow, padding, value, width, }) {
63
63
  function calculateMargins(spaces) {
64
64
  let marginLeft;
65
65
  let marginRight;
@@ -91,7 +91,7 @@ function doStuffWithText({ horizontalAlignment, overflow, padding, value, width,
91
91
  }
92
92
  if (overflow === 'wrap') {
93
93
  const wrappedText = wrapAnsi(valueWithNoZeroWidthChars, spaceForText, { hard: true, trim: true, wordWrap: true });
94
- const { marginLeft, marginRight } = calculateMargins(width - determineWidthOfWrappedText(wrappedText));
94
+ const { marginLeft, marginRight } = calculateMargins(width - determineWidthOfWrappedText(stripAnsi(wrappedText)));
95
95
  const text = wrappedText.replaceAll('\n', `${' '.repeat(marginRight)}\n${' '.repeat(marginLeft)}`);
96
96
  return {
97
97
  marginLeft,
@@ -215,7 +215,7 @@ function row(config) {
215
215
  return (React.createElement(config.cell, { key: key, column: colI, ...config.props }, skeleton.line.repeat(width)));
216
216
  }
217
217
  const key = `${props.key}-cell-${column.key}`;
218
- const { marginLeft, marginRight, text } = doStuffWithText({
218
+ const { marginLeft, marginRight, text } = formatTextWithMargins({
219
219
  horizontalAlignment,
220
220
  overflow,
221
221
  padding,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/table",
3
3
  "description": "Display table in terminal",
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/multi-stage-output/issues",
7
7
  "dependencies": {