From 219c560c7c0ad9e3960298ec125d4e64637fe84b Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Fri, 2 Aug 2024 20:41:29 +0200 Subject: add editor theme and state lua bindings --- src/widgets/statusbar.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/widgets/statusbar.rs') 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, { - 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(&mut self, text: S) -- cgit v1.2.3-70-g09d2