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

Why is the unicode-width dep pinned to version 0.11.1? #423

Open
discosultan opened this issue Aug 12, 2024 · 12 comments
Open

Why is the unicode-width dep pinned to version 0.11.1? #423

discosultan opened this issue Aug 12, 2024 · 12 comments
Labels
question Further information is requested

Comments

@discosultan
Copy link

unicode-width = "=0.1.11"

@russellbanks
Copy link

This is what I could find: #415 (comment).

However this means that you can't use tabled if you have dependencies that also use unicode-width, like ratatui:

error: failed to select a version for `unicode-width`.                                                                                                                                                                                                                                                             
    ... required by package `papergrid v0.12.0`
    ... which satisfies dependency `papergrid = "^0.12"` of package `tabled v0.16.0`
    ... which satisfies dependency `tabled = "^0.16.0"`
versions that meet the requirements `=0.1.11` are: 0.1.11

all possible versions conflict with previously selected packages.

  previously selected package `unicode-width v0.1.13`
    ... which satisfies dependency `unicode-width = "^0.1.13"` of package `ratatui v0.28.0`
    ... which satisfies dependency `ratatui = "^0.28.0"`

@discosultan
Copy link
Author

Ran into the same issue in combination with ratatui :)

@zhiburt
Copy link
Owner

zhiburt commented Aug 15, 2024

Good question

Ahhhh I was not expecting such outcomes

I guess you better stick with v0.14 then till it's resolved?

The thought about this bound was that they had changed the logic of calculations.
So important assumption that width(char) == width(string(char)) no longer true (maybe it was a wrong assumption to begin with).
Because of this some emojie and complex UTF8 symbols was incorrectly rendered.

So I decided to make this bound.
But maybe it shall be investigated (the logic changed accordingly) to be removed.

@zhiburt zhiburt added the question Further information is requested label Aug 15, 2024
@zhiburt
Copy link
Owner

zhiburt commented Aug 23, 2024

@discosultan @russellbanks

I had to mention that you can do it by changes in Cargo.toml

tabled = "=0.14" # or whatever version you were bound to

Sorry for ping; just wanna make sure it's resolved on your end.

Have a great weekend.

@discosultan
Copy link
Author

Thanks for the follow-up. That's the workaround I went with.

Enjoy the weekend.

@joshtriplett
Copy link

I ran into this as well, and it's likewise blocking me from upgrading tabled.

@pipelight
Copy link

From what I understand.

Char/String width computation has changed recently in the unicode-width crate.

  • Some char can have sizes between 0 to 2(column).
  • It now handles char combinations (ex: width("\r\n" == 1) )

Exceptions can be found here:
https://github.com/unicode-rs/unicode-width/blob/master/tests/tests.rs

Upgrading papergrid to the latest unicode-width version will need to replace single character-based width methods (now unusable anymore) by string width methods.

Looking at the inner functionning, this involves some big changes in the crate logic.

@zhiburt
Copy link
Owner

zhiburt commented Sep 22, 2024

Upgrading papergrid to the latest unicode-width version will need to replace single character-based width methods (now unusable anymore) by string width methods.

Exactly.

But I kind of hesitant of it.
I mean personally it's hard to even comprehend what's the source of truth.
In a sense that we must not never calculate chars width or what.
That's something I must figured out.

Looking at the inner functionning, this involves some big changes in the crate logic.

Hopefully not BIG but yes...

@sunshowers
Copy link

FWIW unicode-rs/unicode-width#66 suggests that the unicode-width changes have been reverted in 0.1.14, and the behavior changes are now in 0.2.0.

@sunshowers
Copy link

sunshowers commented Sep 26, 2024

Ah, sorry -- only the newline change has been reverted. The emoji width changes are still present, so they'd have to be worked around. (And yeah, I guess strings would have to be considered holistically).

@joshka
Copy link

joshka commented Sep 27, 2024

This is what I could find: #415 (comment).

However this means that you can't use tabled if you have dependencies that also use unicode-width, like ratatui:

error: failed to select a version for `unicode-width`.                                                                                                                                                                                                                                                             
    ... required by package `papergrid v0.12.0`
    ... which satisfies dependency `papergrid = "^0.12"` of package `tabled v0.16.0`
    ... which satisfies dependency `tabled = "^0.16.0"`
versions that meet the requirements `=0.1.11` are: 0.1.11

all possible versions conflict with previously selected packages.

  previously selected package `unicode-width v0.1.13`
    ... which satisfies dependency `unicode-width = "^0.1.13"` of package `ratatui v0.28.0`
    ... which satisfies dependency `ratatui = "^0.28.0"`

We're discussing what to do with Ratatui in ratatui/ratatui#1271
Our current thinking is that we should go to 0.2.0 and pin at a specific patch version.
If we do that this will fix this problem (as it's possible to have two different minor versions in the same dependency tree, just not patch versions). That is at least until this crate moves on to 0.2.0, from which point the multiple pinned patch versions issue will be a potential problem again.

@zhiburt
Copy link
Owner

zhiburt commented Sep 27, 2024

@joshka maybe we just shall remove this bound here and have some issues with UTF8 😅 , until I figure something out.
Hope to tackle it this weekend.

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

No branches or pull requests

7 participants