From fa3e812a301455c7bc7b4d829a7fba01ddaea413 Mon Sep 17 00:00:00 2001 From: Shav Kinderlehrer Date: Thu, 7 Mar 2024 02:05:03 -0500 Subject: Implement keyboard shortcut popup --- src/components/hello_world.rs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/components/hello_world.rs') diff --git a/src/components/hello_world.rs b/src/components/hello_world.rs index 2e3a2ee..ac9d02b 100644 --- a/src/components/hello_world.rs +++ b/src/components/hello_world.rs @@ -1,9 +1,7 @@ -use ratatui::prelude::*; -use ratatui::widgets::Paragraph; +use ratatui::prelude::{Frame, Rect}; +use ratatui::widgets::{Paragraph, Wrap}; -use crate::app_action::AppAction; use crate::component::Component; -use crate::keys::key_commands::*; #[derive(Default, Clone)] pub struct HelloWorld { @@ -16,17 +14,11 @@ impl Component for HelloWorld { Ok(()) } - fn handle_key_event( - &mut self, - key: crossterm::event::KeyEvent, - ) -> eyre::Result> { - 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); + frame.render_widget( + Paragraph::new(self.text.clone()).wrap(Wrap { trim: true }), + rect, + ); Ok(()) } -- cgit v1.2.3