rhysd / tui-textarea

Simple yet powerful multi-line text editor widget for ratatui and tui-rs
https://crates.io/crates/tui-textarea
MIT License
323 stars 61 forks source link

Widget not implemented? #20

Closed haydenflinner closed 11 months ago

haydenflinner commented 1 year ago

Anyone have any idea how to fix this?

error[E0277]: the trait bound `impl ratatui::widgets::Widget + '_: Widget` is not satisfied
  --> src\components\text_entry.rs:43:21
   |
43 |     f.render_widget(tw, rect);
   |       ------------- ^^ the trait `Widget` is not implemented for `impl ratatui::widgets::Widget + '_`
   |       |
   |       required by a bound introduced by this call
   |
   = help: the following other types implement trait `Widget`:
             BarChart<'a>
             Canvas<'a, F>
             Chart<'a>
             Gauge<'a>
             LineGauge<'a>
             List<'a>
             Paragraph<'a>
             Sparkline<'a>
           and 7 others
note: required by a bound in `ratatui::Frame::<'a, B>::render_widget`
  --> C:\Users\haydu\.cargo\registry\src\github.com-1ecc6299db9ec823\ratatui-0.21.0\src\terminal.rs:88:12
   |
86 |     pub fn render_widget<W>(&mut self, widget: W, area: Rect)
   |            ------------- required by a bound in this associated function
87 |     where
88 |         W: Widget,
   |            ^^^^^^ required by this bound in `Frame::<'a, B>::render_widget`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `wd` (lib) due to previous error
haydenflinner commented 1 year ago

This turned out to be because Cargo was downloading 0.20.1 of ratatui for tui-textarea, while I was using 0.21.0. Fixed by forking and updating the toml file. Don't think my change to return concrete type was necessary. https://github.com/rhysd/tui-textarea/compare/main...haydenflinner:tui-textarea:main

danielo515 commented 1 year ago

@haydenflinner thank you for your fork. Using it works for now.

TheAwiteb commented 1 year ago

You can use ratatui-textarea a fully supported tui-textarea for ratatui

rhysd commented 11 months ago

Closed due to v0.2.1: https://github.com/rhysd/tui-textarea/releases/tag/v0.2.1