This commit is contained in:
2025-11-13 14:05:54 -07:00
parent 2f96492b31
commit 16b6b8f988

View File

@@ -231,14 +231,31 @@ impl App {
// min 20 chars, expand if needed // min 20 chars, expand if needed
let len = max(len as u16 + 1, 20); let len = max(len as u16 + 1, 20);
let bottom_split = Layout::default() let file_name_status = {
let mut file_name = "[No Name]";
let mut icon = "";
if let Some(file) = &self.file {
if let Some(f) = file.file_name() {
if let Some(f) = f.to_str() {
file_name = f;
}
}
}
if self.grid.needs_to_be_saved() {
icon = "[+]";
}
format!("{file_name}{icon}")
};
let cmd_line_split = Layout::default()
.direction(layout::Direction::Horizontal) .direction(layout::Direction::Horizontal)
.constraints([Constraint::Length(len), Constraint::Percentage(50), Constraint::Percentage(50)]) .constraints([Constraint::Length(len), Constraint::Length(file_name_status.len() as u16 + 1), Constraint::Percentage(50), Constraint::Percentage(50)])
.split(cmd_line); .split(cmd_line);
let cmd_line_left = bottom_split[0]; let cmd_line_left = cmd_line_split[0];
let cmd_line_right = bottom_split[1]; let cmd_line_status = cmd_line_split[1];
let cmd_line_debug = bottom_split[2]; let cmd_line_right = cmd_line_split[2];
let cmd_line_debug = cmd_line_split[3];
match &self.mode { match &self.mode {
Mode::Insert(editor) => { Mode::Insert(editor) => {
@@ -261,6 +278,7 @@ impl App {
frame.render_widget(self, body); frame.render_widget(self, body);
frame.render_widget(&self.msg, cmd_line_right); frame.render_widget(&self.msg, cmd_line_right);
frame.render_widget(Paragraph::new(file_name_status), cmd_line_status);
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
frame.render_widget( frame.render_widget(
Paragraph::new(format!( Paragraph::new(format!(