Fixed misaligned outputs and unicode-width dependency version
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
- [x] Use
cargo fmt - [x] Add necessary tests
- [x] Update default config/theme in README (if applicable)
- [x] Update man page at lsd/doc/lsd.md (if applicable)
[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.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
hi @ehwan, thanks so much for fixing the issue, but it seems not to be helping https://github.com/lsd-rs/lsd/issues/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:
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.
This fix worked for me, running Debian on an rPi5.
sorry for the late review, I have tested it and made sure it was really caused by the dependency break.
https://github.com/unicode-rs/unicode-width/issues/55
let's merge this and create a release for it!
thanks so much for the help @ehwan