RangeError on ux.table when column starts with emoji
aaronmgdr opened this issue · comments
Describe the bug
When the dataset includes a column with value with "🔱" e.g. "🔱MasterNode" AND there are sufficiently long strings in columns
RangeError: Invalid count value
at String.repeat (<anonymous>)
at Table.outputTable (node_modules/@oclif/core/lib/cli-ux/styled/table.js:284:37)
at Table.display (node_modules/@oclif/core/lib/cli-ux/styled/table.js:137:22)
at Object.table (node_modules/@oclif/core/lib/cli-ux/styled/table.js:301:39)
To Reproduce
Steps to reproduce the behavior:
import { Command, ux } from '@oclif/core'
export const exampleColumns: ux.Table.table.Columns<{ name: string; otherLongName: string }> = {
name: { get: (row) => row.name },
otherLongName: { get: (row) => row.otherLongName },
}
const data = [
{
name: 'Zeus',
otherLongName:
'antidisestablishmentarianismantidisestablishmentarianismantidisestablishmentarianismantidisestablishmentarianism',
},
{
name: 'Hades',
otherLongName: 'antidisestablishmentarianism',
},
{
name: '🔱 Poseidon 0xDf472FB9a7d4e43F0d46905E0A39De549fB9C4F5',
otherLongName: 'antidisestablishmentarianism',
},
]
export default class Demo extends Command {
async run() {
ux.table(data, exampleColumns)
}
}
Expected behavior
Emoji charaters should not cause table to stop rendering. should be able to see the full table. Note this did not happen in old oclif (pre 1.0)
Environment (please complete the following information):
- OS & version: MacOS Ventura 13.6.1
- Shell/terminal & version : iterm
Additional context
Add any other context about the problem here.
upgrading to from 3.18.1 to 3.19.1 seems to have fixed the issue