diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-02 20:41:29 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-02 20:41:29 +0200 |
| commit | 219c560c7c0ad9e3960298ec125d4e64637fe84b (patch) | |
| tree | b04df9aa63b68739383528a77c229828bdb95773 /src/widgets/statusbar.rs | |
| parent | 595bcac243cb9cdd87e7484ab102c86f3235db8a (diff) | |
add editor theme and state lua bindings
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) |