diff options
Diffstat (limited to 'src/widgets/statusbar.rs')
| -rw-r--r-- | src/widgets/statusbar.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/widgets/statusbar.rs b/src/widgets/statusbar.rs index 61ce1a3..9375d95 100644 --- a/src/widgets/statusbar.rs +++ b/src/widgets/statusbar.rs @@ -1,4 +1,3 @@ - use ratatui::{ crossterm::event::{KeyCode, KeyEvent}, layout::{Alignment, Rect}, @@ -23,12 +22,12 @@ pub struct StatusBar { impl StatusBar { pub fn new() -> Self { Self { - left: String::new(), + left: "".to_string(), left_style: Style::default(), - middle: String::new(), + middle: " ".to_string(), middle_style: Style::default(), middle_alignment: Alignment::Center, - right: String::new(), + right: "".to_string(), right_style: Style::default(), input: None, cursor: 0, @@ -46,7 +45,11 @@ impl StatusBar { where S: AsRef<str>, { - self.middle = text.as_ref().to_string(); + if text.as_ref().is_empty() { + self.middle = " ".to_string(); + } else { + self.middle = text.as_ref().to_string(); + } } pub fn set_right<S>(&mut self, text: S) |