ink
ink copied to clipboard
Add `truncationCharacter` prop for `Text` component
This PR adds a truncationCharacter
prop to the Text
component:
<Box width={7}>
<Text wrap="truncate" truncationCharacter=".">Hello World</Text>
</Box>
//=> 'Hello.'
<Box width={7}>
<Text wrap="truncate" truncationCharacter="+++">Hello World</Text>
</Box>
//=> 'Hel+++'
Resolves #480
@vadimdemedes Sorry to ping. I wrote tests, but I was unable to actually verify them because literally every single test in your test suite seems to fail for some reason.
Don't commit yarn.lock
I wrote tests, but I was unable to actually verify them because literally every single test in your test suite seems to fail for some reason.
Tests are passing on CI, so this sounds like a problem with your setup.
I'm a little concerned how this will affect layout calculation, since truncationCharacter
can be longer than one character. I thought the initial feature request you've had was to simply truncate without the three dots at the end?
This also can't be merged now, because cli-truncate
moved to ESM and Ink didn't. Also, just found and reported an issue about incorrect behavior of that module → https://github.com/sindresorhus/cli-truncate/issues/23. Would you be able to take a look there, since you were the author of truncationCharacter
PR?
I realize it's been a long time, so it's ok if you're not interested anymore, completely understandable.