diff options
author | Shav Kinderlehrer <[email protected]> | 2024-03-06 14:14:07 -0500 |
---|---|---|
committer | Shav Kinderlehrer <[email protected]> | 2024-03-06 14:14:07 -0500 |
commit | c2acb446e7868b67e5743d54cee5c64c469e5a18 (patch) | |
tree | 0a0243b2d064fe2d1d6acf2a21ea93a40ad9a02a /src/components/hello_world.rs | |
parent | a5dbccee4f22de991e33449ae1d1835269c6075d (diff) | |
download | molehole-c2acb446e7868b67e5743d54cee5c64c469e5a18.tar.gz molehole-c2acb446e7868b67e5743d54cee5c64c469e5a18.zip |
Add keyboard commands
Diffstat (limited to 'src/components/hello_world.rs')
-rw-r--r-- | src/components/hello_world.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/components/hello_world.rs b/src/components/hello_world.rs index afb9d47..2e3a2ee 100644 --- a/src/components/hello_world.rs +++ b/src/components/hello_world.rs @@ -1,7 +1,9 @@ use ratatui::prelude::*; use ratatui::widgets::Paragraph; +use crate::app_action::AppAction; use crate::component::Component; +use crate::keys::key_commands::*; #[derive(Default, Clone)] pub struct HelloWorld { @@ -14,7 +16,16 @@ impl Component for HelloWorld { Ok(()) } + fn handle_key_event( + &mut self, + key: crossterm::event::KeyEvent, + ) -> eyre::Result<Option<AppAction>> { + self.text = serialize_key_event(key); + Ok(None) + } + fn render(&mut self, frame: &mut Frame, rect: Rect) -> eyre::Result<()> { + frame.render_widget(Paragraph::new(self.text.clone()), rect); Ok(()) |