templates icon indicating copy to clipboard operation
templates copied to clipboard

feat(component): Add a mean for components to access raw key events

Open louis-thevenet opened this issue 1 year ago • 5 comments

Description

This adds an is_editing method to components for whether they should receive all key inputs or just the regular actions.

Why

Currently, there is no way for a component to take user input.

louis-thevenet avatar Sep 29 '24 08:09 louis-thevenet

Sure! I'm building a markdown tasks parser and manager. I wanted to add a search bar and therefore needed to get user input. Here is how it turned out =)

https://github.com/user-attachments/assets/a8c7cf3e-4efc-4443-a32e-5e25395ad8c8

louis-thevenet avatar Sep 30 '24 08:09 louis-thevenet

that looks pretty! looking forward to the new releases, I want to package it for Arch 🐻

orhun avatar Oct 01 '24 16:10 orhun

I defer to @kdheepak for whether this is the right idea. I'm not too familiar with this template.

joshka avatar Oct 03 '24 02:10 joshka

I think this is a good reference PR! Thanks for making it. I'm not sure if we should merge it though, because the component template is already more complex than I'd like for a template and severely under-documented.

kdheepak avatar Oct 03 '24 06:10 kdheepak

Your review was correct, I think this new version is cleaner. It allows a component to set specific actions to be escaped in editing mode.

I think this is a good reference PR! Thanks for making it. I'm not sure if we should merge it though, because the component template is already more complex than I'd like for a template and severely under-documented.

I agree with you, I'm happy with the template and did not have to change it a lot beside this "can't access raw keys" issue. But it was not a "ready to jump in" template for me, especially for a first Ratatui app, it took me some time to get comfortable with it.

louis-thevenet avatar Oct 03 '24 11:10 louis-thevenet