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
+12 -3
View File
@@ -2233,6 +2233,7 @@ pub struct Editor {
battery_label: String,
shell_label: String,
command_output: Option<ShellOutput>,
queued_command_outputs: VecDeque<ShellOutput>,
git_blame: bool,
gutter_style: crate::gutter::GutterStyle,
line_blame: Option<(BlameSource, Arc<crate::blame::LineBlame>, String)>,
@@ -2351,6 +2352,7 @@ impl Editor {
battery_label: String::new(),
shell_label: String::new(),
command_output: None,
queued_command_outputs: VecDeque::new(),
git_blame: true,
gutter_style: crate::gutter::GutterStyle::default(),
line_blame: None,
@@ -6996,7 +6998,7 @@ impl Editor {
.chars()
.map(|ch| if ch.is_control() { '�' } else { ch })
.collect();
self.command_output = Some(ShellOutput {
let output = ShellOutput {
title: format!("{status} · !{command}"),
wrapping: false,
wrapped_rows: Cell::new(1),
@@ -7007,7 +7009,12 @@ impl Editor {
left: 0,
max_column,
},
});
};
if self.command_output.is_some() {
self.queued_command_outputs.push_back(output);
} else {
self.command_output = Some(output);
}
}
fn handle_command_output(&mut self, input: &Input) -> bool {
@@ -7041,7 +7048,9 @@ impl Editor {
};
let content = &mut output.content;
match input {
Input::Escape | Input::Enter => self.command_output = None,
Input::Escape | Input::Enter => {
self.command_output = self.queued_command_outputs.pop_front()
}
Input::Up | Input::Ctrl('k') => content.top = content.top.saturating_sub(1),
Input::Down | Input::Ctrl('j') => {
content.top = content.top.saturating_add(1).min(rows.saturating_sub(1));