mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
repl: Increase accuracy of error output line height (#14880)
This commit is contained in:
parent
781633fb1a
commit
cd9b25d827
@ -281,7 +281,7 @@ impl ErrorView {
|
|||||||
v_flex()
|
v_flex()
|
||||||
.w_full()
|
.w_full()
|
||||||
.bg(colors.background)
|
.bg(colors.background)
|
||||||
.p_4()
|
.py(cx.line_height() / 2.)
|
||||||
.border_l_1()
|
.border_l_1()
|
||||||
.border_color(theme.status().error_border)
|
.border_color(theme.status().error_border)
|
||||||
.child(
|
.child(
|
||||||
@ -297,7 +297,7 @@ impl ErrorView {
|
|||||||
|
|
||||||
impl LineHeight for ErrorView {
|
impl LineHeight for ErrorView {
|
||||||
fn num_lines(&self, cx: &mut WindowContext) -> u8 {
|
fn num_lines(&self, cx: &mut WindowContext) -> u8 {
|
||||||
let mut height: u8 = 0;
|
let mut height: u8 = 1; // Start at 1 to account for the y padding
|
||||||
height = height.saturating_add(self.ename.lines().count() as u8);
|
height = height.saturating_add(self.ename.lines().count() as u8);
|
||||||
height = height.saturating_add(self.evalue.lines().count() as u8);
|
height = height.saturating_add(self.evalue.lines().count() as u8);
|
||||||
height = height.saturating_add(self.traceback.num_lines(cx));
|
height = height.saturating_add(self.traceback.num_lines(cx));
|
||||||
|
@ -78,7 +78,14 @@ impl TerminalOutput {
|
|||||||
})
|
})
|
||||||
.collect::<Vec<TextRun>>();
|
.collect::<Vec<TextRun>>();
|
||||||
|
|
||||||
let text = StyledText::new(self.handler.buffer.trim_end().to_string()).with_runs(runs);
|
// Trim the last trailing newline for visual appeal
|
||||||
|
let trimmed = self
|
||||||
|
.handler
|
||||||
|
.buffer
|
||||||
|
.strip_suffix('\n')
|
||||||
|
.unwrap_or(&self.handler.buffer);
|
||||||
|
|
||||||
|
let text = StyledText::new(trimmed.to_string()).with_runs(runs);
|
||||||
div()
|
div()
|
||||||
.font_family(buffer_font)
|
.font_family(buffer_font)
|
||||||
.child(text)
|
.child(text)
|
||||||
@ -212,7 +219,7 @@ impl Perform for TerminalHandler {
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
// Format as hex
|
// Format as hex
|
||||||
println!("[execute] byte={:02x}", byte);
|
// println!("[execute] byte={:02x}", byte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user