Git Product home page Git Product logo

Comments (13)

rhysd avatar rhysd commented on July 17, 2024

Please paste entire error message. I see no conflict. >=0.23.0 means 0.23 or later. So 0.24 should be allowed.

And cargo update may resolve the issue if your local lock file is outdated.

from tui-textarea.

joshka avatar joshka commented on July 17, 2024

How about we bump gitui to 0.24 instead? I'll slap a PR for it together.

from tui-textarea.

joshka avatar joshka commented on July 17, 2024

extrawurst/gitui#1959

from tui-textarea.

pm100 avatar pm100 commented on July 17, 2024

@joshka - it doubt it will be accepted soon. I have worked with gitui for 3 years, owner has very aggressive cargo check deny policy of duplicated crates etc. There is another issue blocking a ton of stuff for months extrawurst/gitui#1781 (I have a PR that been sitting there for 5 months).

This is a classic example of whats wrong with cargo version management, its almost perfect, but not quite, and its hard to override (patch does not help here)

from tui-textarea.

pm100 avatar pm100 commented on July 17, 2024

here you see the clash because my file textinput.rs receives Style arguments from gitui and passes the to tta

   Compiling gitui v0.24.3 (C:\work\git4\gitui)
error[E0308]: mismatched types
    --> src\components\textinput.rs:211:28
     |
211  |                 .set_cursor_line_style(self.theme.text(true, false));
     |                  --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found a different `ratatui::style::Style`
     |                  |
     |                  arguments to this method are incorrect
     |
     = note: `ratatui::style::Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> C:\Users\paulm\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ratatui-0.23.0\src\style.rs:253:1
     |
253  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> C:\Users\paulm\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ratatui-0.24.0\src\style.rs:192:1
     |
192  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> C:\Users\paulm\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tui-textarea-0.3.1\src\textarea.rs:1203:12
     |
1203 |     pub fn set_cursor_line_style(&mut self, style: Style) {
     |            ^^^^^^^^^^^^^^^^^^^^^

from tui-textarea.

joshka avatar joshka commented on July 17, 2024

I know that the bitflags change is problematic - it will change the serialization format, which will mean that configuration breaks for every user.

from tui-textarea.

pm100 avatar pm100 commented on July 17, 2024

Extrawurst already has that fixed in a branch. I raised it when I first was trying to get tta into gitui. This is a long saga . See extrawurst/gitui#1929

from tui-textarea.

rhysd avatar rhysd commented on July 17, 2024

here you see the clash because my file textinput.rs receives Style arguments from gitui and passes the to tta

Isn't it your local problem with old Cargo.lock file? If not, I think you need to understand what crate requires ratatui 0.24 and what crate requires 0.23.

from tui-textarea.

rhysd avatar rhysd commented on July 17, 2024

I confirmed ratatui 0.23 worked with tui-textarea fine. cargo test passed and cargo run --example editor worked. If it's not your local problem, I guess some other crate in your dependencies requires 0.24 or later.

> cargo tree --edges no-dev
tui-textarea v0.4.0
├── crossterm v0.27.0
│   ├── bitflags v2.4.1
│   ├── crossterm_winapi v0.9.1
│   │   └── winapi v0.3.9
│   ├── parking_lot v0.12.1
│   │   ├── lock_api v0.4.11
│   │   │   └── scopeguard v1.2.0
│   │   │   [build-dependencies]
│   │   │   └── autocfg v1.1.0
│   │   └── parking_lot_core v0.9.9
│   │       ├── cfg-if v1.0.0
│   │       ├── smallvec v1.11.2
│   │       └── windows-targets v0.48.5
│   │           └── windows_x86_64_msvc v0.48.5
│   └── winapi v0.3.9
├── ratatui v0.23.0
│   ├── bitflags v2.4.1
│   ├── cassowary v0.3.0
│   ├── crossterm v0.27.0 (*)
│   ├── indoc v2.0.4 (proc-macro)
│   ├── itertools v0.11.0
│   │   └── either v1.9.0
│   ├── paste v1.0.14 (proc-macro)
│   ├── strum v0.25.0
│   │   └── strum_macros v0.25.3 (proc-macro)
│   │       ├── heck v0.4.1
│   │       ├── proc-macro2 v1.0.69
│   │       │   └── unicode-ident v1.0.12
│   │       ├── quote v1.0.33
│   │       │   └── proc-macro2 v1.0.69 (*)
│   │       ├── rustversion v1.0.14 (proc-macro)
│   │       └── syn v2.0.39
│   │           ├── proc-macro2 v1.0.69 (*)
│   │           ├── quote v1.0.33 (*)
│   │           └── unicode-ident v1.0.12
│   ├── unicode-segmentation v1.10.1
│   └── unicode-width v0.1.11
└── unicode-width v0.1.11

from tui-textarea.

rhysd avatar rhysd commented on July 17, 2024

I created a dummy project to confirm this is not a problem of tui-textarea. The configuration was:

[dependencies]
ratatui = { version = "0.23", default-features = false, features = ['crossterm', 'serde'] }
tui-textarea = "0.4.0"

and I checked the dependencies tree. ratatui v0.23.0 was correctly shared between the dummy project and tui-textarea:

> cargo tree
test_project v0.1.0
├── ratatui v0.23.0
│   ├── bitflags v2.4.1
│   │   └── serde v1.0.193
│   │       └── serde_derive v1.0.193 (proc-macro)
│   │           │   └── unicode-ident v1.0.12
│   │           ├── quote v1.0.33
│   │           │   └── proc-macro2 v1.0.69 (*)
│   │           └── syn v2.0.39
│   │               ├── proc-macro2 v1.0.69 (*)
│   │               ├── quote v1.0.33 (*)
│   │               └── unicode-ident v1.0.12
│   ├── cassowary v0.3.0
│   ├── crossterm v0.27.0
│   │   ├── bitflags v2.4.1 (*)
│   │   ├── crossterm_winapi v0.9.1
│   │   │   └── winapi v0.3.9
│   │   ├── parking_lot v0.12.1
│   │   │   ├── lock_api v0.4.11
│   │   │   │   └── scopeguard v1.2.0
│   │   │   │   [build-dependencies]
│   │   │   │   └── autocfg v1.1.0
│   │   │   └── parking_lot_core v0.9.9
│   │   │       ├── cfg-if v1.0.0
│   │   │       ├── smallvec v1.11.2
│   │   │       └── windows-targets v0.48.5
│   │   │           └── windows_x86_64_msvc v0.48.5
│   │   └── winapi v0.3.9
│   ├── indoc v2.0.4 (proc-macro)
│   ├── itertools v0.11.0
│   │   └── either v1.9.0
│   ├── paste v1.0.14 (proc-macro)
│   ├── serde v1.0.193 (*)
│   ├── strum v0.25.0
│   │   └── strum_macros v0.25.3 (proc-macro)
│   │       ├── heck v0.4.1
│   │       ├── proc-macro2 v1.0.69 (*)
│   │       ├── quote v1.0.33 (*)
│   │       ├── rustversion v1.0.14 (proc-macro)
│   │       └── syn v2.0.39 (*)
│   ├── unicode-segmentation v1.10.1
│   └── unicode-width v0.1.11
└── tui-textarea v0.4.0
    ├── crossterm v0.27.0 (*)
    ├── ratatui v0.23.0 (*)
    └── unicode-width v0.1.11

from tui-textarea.

pm100 avatar pm100 commented on July 17, 2024

@rhysd - ty for looking at this. I was not very clear. I know how to make this work by hand editing the cargo.lock file, works perfectly, and is not a problem with tui-textarea. But I doubt owner will accept that.

You have experience with complex version juggling (tui, ratatui, crossterm....) and wondered if you had any tricks that I could use. Seems not

from tui-textarea.

pacak avatar pacak commented on July 17, 2024

I created a dummy project to confirm this is not a problem of tui-textarea. The configuration was:

FWIW I created the same project just now

[package]
name = "foo2"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ratatui = { version = "0.23", default-features = false, features = ['crossterm', 'serde'] }
tui-textarea = "0.4.0"

And the tree looks like this:

foo2 v0.1.0 (/path/to/project)
├── ratatui v0.23.0
│   ├── bitflags v2.4.1
│   │   └── serde v1.0.195
│   │       └── serde_derive v1.0.195 (proc-macro)
│   │           ├── proc-macro2 v1.0.76
│   │           │   └── unicode-ident v1.0.12
│   │           ├── quote v1.0.35
│   │           │   └── proc-macro2 v1.0.76 (*)
│   │           └── syn v2.0.48
│   │               ├── proc-macro2 v1.0.76 (*)
│   │               ├── quote v1.0.35 (*)
│   │               └── unicode-ident v1.0.12
│   ├── cassowary v0.3.0
│   ├── crossterm v0.27.0
│   │   ├── bitflags v2.4.1 (*)
│   │   ├── libc v0.2.152
│   │   ├── mio v0.8.10
│   │   │   ├── libc v0.2.152
│   │   │   └── log v0.4.20
│   │   ├── parking_lot v0.12.1
│   │   │   ├── lock_api v0.4.11
│   │   │   │   └── scopeguard v1.2.0
│   │   │   │   [build-dependencies]
│   │   │   │   └── autocfg v1.1.0
│   │   │   └── parking_lot_core v0.9.9
│   │   │       ├── cfg-if v1.0.0
│   │   │       ├── libc v0.2.152
│   │   │       └── smallvec v1.11.2
│   │   ├── signal-hook v0.3.17
│   │   │   ├── libc v0.2.152
│   │   │   └── signal-hook-registry v1.4.1
│   │   │       └── libc v0.2.152
│   │   └── signal-hook-mio v0.2.3
│   │       ├── libc v0.2.152
│   │       ├── mio v0.8.10 (*)
│   │       └── signal-hook v0.3.17 (*)
│   ├── indoc v2.0.4 (proc-macro)
│   ├── itertools v0.11.0
│   │   └── either v1.9.0
│   ├── paste v1.0.14 (proc-macro)
│   ├── serde v1.0.195 (*)
│   ├── strum v0.25.0
│   │   └── strum_macros v0.25.3 (proc-macro)
│   │       ├── heck v0.4.1
│   │       ├── proc-macro2 v1.0.76 (*)
│   │       ├── quote v1.0.35 (*)
│   │       ├── rustversion v1.0.14 (proc-macro)
│   │       └── syn v2.0.48 (*)
│   ├── unicode-segmentation v1.10.1
│   └── unicode-width v0.1.11
└── tui-textarea v0.4.0
    ├── crossterm v0.27.0 (*)
    ├── ratatui v0.25.0
    │   ├── bitflags v2.4.1 (*)
    │   ├── cassowary v0.3.0
    │   ├── crossterm v0.27.0 (*)
    │   ├── indoc v2.0.4 (proc-macro)
    │   ├── itertools v0.12.0
    │   │   └── either v1.9.0
    │   ├── lru v0.12.1
    │   │   └── hashbrown v0.14.3
    │   │       ├── ahash v0.8.7
    │   │       │   ├── cfg-if v1.0.0
    │   │       │   ├── once_cell v1.19.0
    │   │       │   └── zerocopy v0.7.32
    │   │       │   [build-dependencies]
    │   │       │   └── version_check v0.9.4
    │   │       └── allocator-api2 v0.2.16
    │   ├── paste v1.0.14 (proc-macro)
    │   ├── stability v0.1.1 (proc-macro)
    │   │   ├── quote v1.0.35 (*)
    │   │   └── syn v1.0.109
    │   │       ├── proc-macro2 v1.0.76 (*)
    │   │       ├── quote v1.0.35 (*)
    │   │       └── unicode-ident v1.0.12
    │   ├── strum v0.25.0 (*)
    │   ├── unicode-segmentation v1.10.1
    │   └── unicode-width v0.1.11
    └── unicode-width v0.1.11

foo2 pulls in ratatui 0.23 as expected, tta pulls in 0.25 as the most recent available version.

I can make it behave in two different ways. Adding tta into a project with already existing ratatui makes it so tta uses it - I'm assuming you used cargo add if it was a new project, adding it to a project at the same time as ratatui or simply not having the lock file - pulls in two different versions and causes problems.

from tui-textarea.

Gnurfos avatar Gnurfos commented on July 17, 2024

Hi,

This issue, combined with cargo's rust-lang/cargo#9029 is forcing us to commit Cargo.lock in all of our libraries, even the ones higher up the tree (which don't depend on tui things directly), which is not a place where we want to be.

It looks like the fix/change on cargo side will take a long time at best. Is there any chance you'd reconsider expressing your dependency in a more classical way ?

Thanks

from tui-textarea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.