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

Truncate without … #480

Closed
codemaster138 opened this issue Oct 6, 2021 · 4 comments
Closed

Truncate without … #480

codemaster138 opened this issue Oct 6, 2021 · 4 comments

Comments

@codemaster138
Copy link

I'm trying to create an app with ink.js and I need to truncate a string, but without .

I looked through the code of the <Text> component, but it just passes the wrap property on to an underlying <ink-text> component which AFAIK puts altering the way truncation works out of my reach.

I tried limiting the size of the box but leaving wrap set to its default value "wrap", but that resulted in the text wrapping out of its container and overwriting components that came after it – not exactly ideal.

Is there some way to truncate text without adding the character?

@codemaster138
Copy link
Author

I'd love if we could just have a prop truncateCharacter that we can pass to <Text> to alter the character.

I'll try to write a PR for this right now

@codemaster138
Copy link
Author

Update: Currently waiting for PR sindresorhus/cli-truncate#19 to be merged, then I'll finish this up

@vadimdemedes
Copy link
Owner

Sounds like a valid use case, looking forward to the PR!

@vadimdemedes
Copy link
Owner

Closing until more users want this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants