tabled icon indicating copy to clipboard operation
tabled copied to clipboard

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

Open discosultan opened this issue 1 year ago • 13 comments

https://github.com/zhiburt/tabled/blob/300c07bd53c945671e8115811c1689cb1353feff/papergrid/Cargo.toml#L16

discosultan avatar Aug 12 '24 13:08 discosultan

This is what I could find: https://github.com/zhiburt/tabled/pull/415#issuecomment-2231893362.

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"`

russellbanks avatar Aug 13 '24 11:08 russellbanks

Ran into the same issue in combination with ratatui :)

discosultan avatar Aug 13 '24 11:08 discosultan

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 avatar Aug 15 '24 22:08 zhiburt

@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.

zhiburt avatar Aug 23 '24 20:08 zhiburt

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

Enjoy the weekend.

discosultan avatar Aug 23 '24 21:08 discosultan

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

joshtriplett avatar Aug 25 '24 02:08 joshtriplett

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.

pipelight avatar Sep 17 '24 18:09 pipelight

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...

zhiburt avatar Sep 22 '24 09:09 zhiburt

FWIW https://github.com/unicode-rs/unicode-width/issues/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 avatar Sep 26 '24 01:09 sunshowers

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).

sunshowers avatar Sep 26 '24 01:09 sunshowers

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 https://github.com/ratatui/ratatui/issues/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.

joshka avatar Sep 27 '24 17:09 joshka

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

zhiburt avatar Sep 27 '24 19:09 zhiburt

I think this issue can now be closed.

joshtriplett avatar Oct 22 '24 02:10 joshtriplett

Must be released; Eventually :sweat_smile:

tabled = "=0.17.0"

Thanks @joshtriplett once again.

zhiburt avatar Nov 22 '24 21:11 zhiburt