Why doesn't `TextArea` implement `Widget` trait
fmorroni opened this issue · 8 comments
fmorroni commented
Hi, why doesn't TextArea
implement the Widget
trait? I know we have the widget()
method but that seems kind of unnecessary to me. Is there an advantage to having it that way?
rhysd commented
because Widget::render
requires to move out self
rhysd commented
I noticed that &TextArea
can implement Widget
. It might be smarter.
impl<'a> Widget for &'a TextArea<'a> {
// ...
}
// Usage
term.draw(|f| {
f.render_widget(&textarea, f.size());
})?;
fmorroni commented
I noticed that
&TextArea
can implementWidget
. It might be smarter.impl<'a> Widget for &'a TextArea<'a> { // ... } // Usage term.draw(|f| { f.render_widget(&textarea, f.size()); })?;
Yeah that's basically what I did for a vim input widget I'm making. Seems to work fine.
rhysd commented
This was included in v0.5.3 release.
fmorroni commented
This was included in v0.5.3 release.
Great thanks!