-
Notifications
You must be signed in to change notification settings - Fork 326
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Ownership in Frame::render_widget #591
Comments
Historical reasons to some extent. See the following for some more details:
TL;DR: widget was designed for Put in terms of your problem, there can't be an active
For the method that creates a widget you could even fairly easily make the render part of the component by creating a small intermediary like:
It's also worth taking a look at https://ratatui.rs/concepts/application-patterns/index.html for some ideas about how to handle this as well as looking at how some larger examples structure their code (I was particularly inspired by EDMA when building toot-rs and yazi took some of those ideas a bit further. Working out how to handle multiple views was a difficult thing for me to understand when I first started playing with Ratatui, and there's more examples of this out there (see also @kdheepak's ratatui async template as one option). P.S. I'm going to convert this to a discussion rather than an issue. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Is there a reason why
widget: W
needs to be owned here? Causing me some headaches when trying to keep different screens in the same field as I can't go from aBox<dyn Widget>
to an owned/sizedWidget
... (i.e. keeping a currently active interchangeableWidget
in app state).https://github.com/ratatui-org/ratatui/blob/c597b87f72bc578cdd65d533506db5bdc49af608/src/terminal.rs#L600
Maybe I'm going about things completely wrong and there's another way to achieve this, but nothing I've found during all of today anyway 😓
The text was updated successfully, but these errors were encountered: