Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove newlines when truncating text #13

Merged
merged 6 commits into from
Oct 4, 2024

Conversation

mdonnalley
Copy link
Contributor

No description provided.

const text = cliTruncate(valueWithNoZeroWidthChars, spaceForText, {position: determineTruncatePosition(overflow)})
const text = cliTruncate(valueWithNoZeroWidthChars.replaceAll('\n', ' '), spaceForText, {
position: determineTruncatePosition(overflow),
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to create a simple test for this newline replacement so we don't have a regression later.

Also, unrelated: this uncovered an issue with align-center where the first line is not centered.

Wrap (aligned center)
┌───────┬─────────┬─────┬───────────────────────────────────────────────────────────────────────────┐
│  Id   │  Name   │ Age │                                Description                                │
├───────┼─────────┼─────┼───────────────────────────────────────────────────────────────────────────┤
│ 36329 │  Alice  │ 20  │  Lorem ipsum dolor sit amet, consectetur                                  │
│       │         │     │                                   adipi                                   │
│       │         │     │  scing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna   │
│       │         │     │                                  aliqua.                                  │
├───────┼─────────┼─────┼───────────────────────────────────────────────────────────────────────────┤
│ 49032 │   Bob   │ 21  │  Lorem ipsum dolor sit amet, consectetur                                  │
│       │         │     │                                   adipi                                   │
│       │         │     │  scing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna   │
│       │         │     │                                  aliqua.                                  │
├───────┼─────────┼─────┼───────────────────────────────────────────────────────────────────────────┤
│ 51786 │ Charlie │ 22  │  Lorem ipsum dolor sit amet, consectetur                                  │
│       │         │     │                                   adipi                                   │
│       │         │     │  scing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna   │
│       │         │     │                                  aliqua.                                  │
└───────┴─────────┴─────┴───────────────────────────────────────────────────────────────────────────┘

@iowillhoit iowillhoit merged commit 95a73fa into main Oct 4, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants