-
Notifications
You must be signed in to change notification settings - Fork 18
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
Support using heh
as a Ratatui widget
#120
Conversation
Moves the module definitions to lib.rs and exposes some types for usage
Adds App::render_frame method
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
|
Wow, this is amazing! I'll try and review and come back to you in a couple of days. I've been really busy with life lately, so I haven't had the time to really give this repo as much love as I want. You demo looks really really cool, and I'm glad you could make use of heh :) |
Thanks a lot! I will be looking forward to your review and happy to improve the code 🐻
I'm thinking of submitting some other PRs, mainly about updating Ratatui to the latest version. Happy to work on other issues as well.
Right now it is fully functional and I am so satisfied with it. Thanks for building |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for waiting, I think this looks good for the most part!
One thing I wanted to get your input on was the module_name_repititions clippy error that we're getting with LabelHandler
, ScreenHandler
, and AppData
- to fix this, I'm thinking of changing the names of these structs right now and users of the library would have to specify screen::Handler
, label::Handler
, and app::Data
. I'm of the mind that this is probably better for the longevity of heh
as a library, but was curious what you thought.
There are other clippy lints failing, but if you don't have the time to fix them, I can go ahead and get around to cleaning the up after I push this through -- I don't wanna block any progress on your work!
Also let me know if after this gets merged, you would want me to make a release :)
```rust | ||
heh.handle_input(crossterm::event::Event::Key(/* */)).unwrap(); | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to add a link to binsider as an example use case of using this as a library!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Added in 0d77149
} | ||
|
||
/// Renders a single frame for the given area. | ||
pub fn render_frame(&mut self, frame: &mut Frame, area: Rect) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be willing to create an issue so that at some point I remember to create tests specifically for render_frame
and handle_input
? I'll have to look into it but I think I'll want more coverage on these now that they'll be library functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beep beep, you got it!
#124
I think that would be perfect! I personally never liked the name "Handler" (reminds me of Java 🤮) Do you want me to do it in this PR or are you going to work on that separately?
Works fine for me, thank you!
Please do 🙂 |
I'd appreciate if you could do it in this PR! Haha you can tell I come from Java xD After the names are fixed to your liking, I'll merge this and hopefully have the time to push a release 👍 |
Okay, one issue: use crate::{app::Data, label::Handler, screen::Handler}; In that case we are importing both I will think of an alternative name. |
Using an alias is what I had in mind! I completely trust whatever alternative names you come up with too. |
Okay, all should be good now. I renamed the types and fixed the lints. Let me know 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll try and get a release out soon, I really appreciate your PR :)
Just created a release 🥳 let me know if there's anything else I should do, thanks again! |
Awesome, thanks a lot for your cooperation on this! Here I bumped the |
Hey! 🐻
I'm currently working on a TUI that allows analyzing ELF files and I would like to have
heh
as a component in there because I think it is a pretty awesome app! (and I don't want to rewrite the same functionality :D)This PR simply makes that possible!
The summary of the changes:
lib.rs
for usingheh
as a libraryApplication
,Encoding
,ScreenHandler
,ComponentLayouts
)Application::render_frame
for rendering a single frame.impl ratatui::widgets::Widget for Application
but it requires some additional work on restructuring the internal types.ScreenHandler
holding some state - i.e. I can't mutate it inside theterminal.draw
closure.See this commit for the implementation in my app.
Demo (see the "hexdump" tab):
Cheers!