fix: place command status left of battery as a separate segment

This commit is contained in:
2026-10-18 01:35:52 +02:00
parent e310b76794
commit d8cfd27ee6
10 changed files with 165 additions and 58 deletions
+21
View File
@@ -15528,3 +15528,24 @@ fn shell_output_wrap_bindings_respect_remaps_disabled_keys_and_sequence_cancella
editor.handle(Input::Escape);
assert!(editor.command_output().is_none());
}
#[test]
fn shared_shell_status_is_a_separate_segment_left_of_the_battery() {
let mut editor = Editor::open(None, vec![]).unwrap();
editor.set_battery_charge(Some(27));
editor.set_shell_label("sle... | pwd /".into());
let mut terminal = Terminal::new(ratatui::backend::TestBackend::new(80, 12)).unwrap();
let mut views = BufferViewports::default();
terminal
.draw(|frame| views.draw(frame, &mut editor))
.unwrap();
let top = pane_screen(&terminal, Rect::new(0, 0, 80, 1));
assert!(top.contains("░▓ sle... | pwd / ▓░ ░▓ bat 27%"), "{top}");
editor.set_shell_label(String::new());
terminal
.draw(|frame| views.draw(frame, &mut editor))
.unwrap();
let top = pane_screen(&terminal, Rect::new(0, 0, 80, 1));
assert!(!top.contains("sle..."));
assert!(top.trim_end().ends_with("bat 27%"), "{top}");
}