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

ansi: TruncateLeft does not work as expected #329

Closed
pranavkrishnan02 opened this issue Jan 14, 2025 · 1 comment
Closed

ansi: TruncateLeft does not work as expected #329

pranavkrishnan02 opened this issue Jan 14, 2025 · 1 comment

Comments

@pranavkrishnan02
Copy link
Contributor

Describe the bug

  1. The description of ansi.TruncateLeft seems to indicate length is the length of the string returned but it's actually the number of characters that get removed (see @caarlos0 's PR)
  2. When truncating 0 characters, the entire string should be returned but it returns an empty string instead

Fix: #328

Source Code

Running ansi.TruncateLeft("abc", 0, "") returns ""

Expected behavior

It should return "abc"

@caarlos0
Copy link
Member

#328 is merged, closing this!

thanks @pranavkrishnan02

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

No branches or pull requests

2 participants