diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/widgets/tui_folder_view.rs | 2 | ||||
-rw-r--r-- | src/ui/widgets/tui_menu.rs | 2 | ||||
-rw-r--r-- | src/ui/widgets/tui_prompt.rs | 3 | ||||
-rw-r--r-- | src/ui/widgets/tui_textfield.rs | 4 | ||||
-rw-r--r-- | src/ui/widgets/tui_view.rs | 8 |
5 files changed, 8 insertions, 11 deletions
diff --git a/src/ui/widgets/tui_folder_view.rs b/src/ui/widgets/tui_folder_view.rs index 6c145dd..df14f73 100644 --- a/src/ui/widgets/tui_folder_view.rs +++ b/src/ui/widgets/tui_folder_view.rs @@ -107,7 +107,7 @@ impl<'a> Widget for TuiFolderView<'a> { if self.show_bottom_status { /* draw the bottom status bar */ if let Some(msg) = self.context.worker_msg() { - let text = Span::styled(msg.as_str(), message_style); + let text = Span::styled(msg, message_style); Paragraph::new(text) .wrap(Wrap { trim: true }) .render(rect, buf); diff --git a/src/ui/widgets/tui_menu.rs b/src/ui/widgets/tui_menu.rs index e37c28f..fcd47ce 100644 --- a/src/ui/widgets/tui_menu.rs +++ b/src/ui/widgets/tui_menu.rs @@ -39,7 +39,6 @@ impl TuiCommandMenu { terminal.draw(|frame| { let f_size: Rect = frame.size(); - { let view = TuiView::new(&context); frame.render_widget(view, f_size); @@ -122,7 +121,6 @@ impl<'a> TuiMenu<'a> { } } - impl<'a> Widget for TuiMenu<'a> { fn render(self, area: Rect, buf: &mut Buffer) { let text_iter = self.options.iter().chain(&[" "]); diff --git a/src/ui/widgets/tui_prompt.rs b/src/ui/widgets/tui_prompt.rs index 112db21..ea6aa49 100644 --- a/src/ui/widgets/tui_prompt.rs +++ b/src/ui/widgets/tui_prompt.rs @@ -2,7 +2,7 @@ use termion::event::Key; use tui::layout::Rect; use tui::style::{Color, Style}; use tui::text::Span; -use tui::widgets::{Paragraph, Wrap}; +use tui::widgets::{Clear, Paragraph, Wrap}; use crate::context::JoshutoContext; use crate::ui::TuiBackend; @@ -48,6 +48,7 @@ impl<'a> TuiPrompt<'a> { height: 1, }; + frame.render_widget(Clear, textfield_rect); frame.render_widget( Paragraph::new(text).wrap(Wrap { trim: true }), textfield_rect, diff --git a/src/ui/widgets/tui_textfield.rs b/src/ui/widgets/tui_textfield.rs index 3ca7ad9..5d6427d 100644 --- a/src/ui/widgets/tui_textfield.rs +++ b/src/ui/widgets/tui_textfield.rs @@ -41,7 +41,9 @@ pub struct TuiTextField<'a> { impl<'a> TuiTextField<'a> { pub fn menu_items<I>(&mut self, items: I) -> &mut Self - where I: Iterator<Item = &'a str> { + where + I: Iterator<Item = &'a str>, + { self._menu_items = Some(items.collect()); self } diff --git a/src/ui/widgets/tui_view.rs b/src/ui/widgets/tui_view.rs index 29a8122..f86eaec 100644 --- a/src/ui/widgets/tui_view.rs +++ b/src/ui/widgets/tui_view.rs @@ -1,8 +1,6 @@ use tui::buffer::Buffer; -use tui::layout::{Direction, Layout, Rect}; -use tui::style::{Color, Style}; -use tui::text::Span; -use tui::widgets::{Paragraph, Widget, Wrap}; +use tui::layout::Rect; +use tui::widgets::Widget; use super::TuiFolderView; use crate::context::JoshutoContext; @@ -14,8 +12,6 @@ pub struct TuiView<'a> { pub show_bottom_status: bool, } -use super::super::{DEFAULT_LAYOUT, NO_PREVIEW_LAYOUT}; - impl<'a> TuiView<'a> { pub fn new(context: &'a JoshutoContext) -> Self { Self { |