repl: Ensure that the output's computed line height is at least 1 (#14877)

This commit is contained in:
Kyle Kelley
2024-07-20 15:59:28 -07:00
committed by GitHub
parent 6dfb0a4a70
commit 781633fb1a
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -553,9 +553,10 @@ impl LineHeight for ExecutionView {
self.outputs
.iter()
.map(|output| output.num_lines(cx))
.fold(0, |acc, additional_height| {
.fold(0_u8, |acc, additional_height| {
acc.saturating_add(additional_height)
})
.max(1)
}
}
+1 -1
View File
@@ -88,7 +88,7 @@ impl TerminalOutput {
impl LineHeight for TerminalOutput {
fn num_lines(&self, _cx: &mut WindowContext) -> u8 {
self.handler.buffer.lines().count() as u8
self.handler.buffer.lines().count().max(1) as u8
}
}