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

Fixed misaligned outputs and unicode-width dependency version #1064

Merged
merged 4 commits into from
Aug 20, 2024

Conversation

ehwan
Copy link
Contributor

@ehwan ehwan commented Jun 18, 2024

This could possibly fix misaligned output issues #1063

The problem occured only if when I cargo install lsd, not when I build it directly from the clone or install it via brew.

This is because of the dependency unicode-width's version. The version installed via cargo install was using the latest unicode-width, v0.1.13, but others were using v0.1.11 because of Cargo.lock.

The dependency unicode-width had a breaking change between v0.1.11 and v0.1.13 that returns a different result when counting unicode characters.

The new behavior in unicode-width v0.1.13 is more intuitive for calculating the length of a unicode string, so I fixed the logic accordingly.


TODO

  • Use cargo fmt
  • Add necessary tests
  • Update default config/theme in README (if applicable)
  • Update man page at lsd/doc/lsd.md (if applicable)

@ehwan ehwan requested a review from zwpaper as a code owner June 18, 2024 16:04
Copy link

muniu-bot bot commented Jun 18, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ehwan
Once this PR has been reviewed and has the lgtm label, please assign zwpaper for approval by writing /assign @zwpaper in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@muniu-bot muniu-bot bot added the size/XS label Jun 18, 2024
@muniu-bot muniu-bot bot added size/S and removed size/XS labels Jun 19, 2024
@ehwan ehwan changed the title Fixed misaligned outputs Fixed misaligned outputs and unicode-width dependency version Jun 20, 2024
@zwpaper
Copy link
Member

zwpaper commented Jun 22, 2024

hi @ehwan, thanks so much for fixing the issue, but it seems not to be helping #1054, can you add some tests so that we can make sure it works?

I cloned your code and change one of my icon to unicode:

CleanShot 2024-06-22 at 11 49 22@2x

@ehwan
Copy link
Contributor Author

ehwan commented Jun 22, 2024

Hi @zwpaper, and thank you for reviewing.

I apologize that I misunderstood the term 'misaligned' in #1054. This PR does not fix the issue.
I've deleted the mention in the description.

@hucklesberries
Copy link

This fix worked for me, running Debian on an rPi5.

hucklesberries added a commit to hucklesberries/lsd that referenced this pull request Jul 11, 2024
@zwpaper
Copy link
Member

zwpaper commented Aug 20, 2024

sorry for the late review, I have tested it and made sure it was really caused by the dependency break.

unicode-rs/unicode-width#55

let's merge this and create a release for it!

@zwpaper zwpaper merged commit 8921545 into lsd-rs:master Aug 20, 2024
@zwpaper
Copy link
Member

zwpaper commented Aug 20, 2024

thanks so much for the help @ehwan

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

Successfully merging this pull request may close these issues.

3 participants