|
1 | 1 | use core::cmp::Ordering;
|
2 | 2 |
|
3 |
| -use anyhow::{Result, bail}; |
| 3 | +use anyhow::Result; |
4 | 4 | use crossterm::event::{Event, KeyCode, KeyEventKind, KeyModifiers, MouseButton, MouseEventKind};
|
5 | 5 | use objdiff_core::{
|
| 6 | + build::BuildStatus, |
6 | 7 | diff::{
|
7 | 8 | DiffObjConfig, FunctionRelocDiffs, InstructionDiffKind, ObjectDiff, SymbolDiff,
|
8 | 9 | display::{DiffText, DiffTextColor, HighlightKind, display_row},
|
@@ -126,6 +127,11 @@ impl UiView for FunctionDiffUi {
|
126 | 127 | );
|
127 | 128 | max_width = max_width.max(text.width());
|
128 | 129 | left_text = Some(text);
|
| 130 | + } else if let Some(status) = &state.left_status { |
| 131 | + let mut text = Text::default(); |
| 132 | + self.print_build_status(&mut text, status); |
| 133 | + max_width = max_width.max(text.width()); |
| 134 | + left_text = Some(text); |
129 | 135 | }
|
130 | 136 |
|
131 | 137 | let mut right_text = None;
|
@@ -155,6 +161,11 @@ impl UiView for FunctionDiffUi {
|
155 | 161 | let rect = content_chunks[1].inner(Margin::new(1, 1));
|
156 | 162 | self.print_margin(&mut text, symbol_diff, rect);
|
157 | 163 | margin_text = Some(text);
|
| 164 | + } else if let Some(status) = &state.right_status { |
| 165 | + let mut text = Text::default(); |
| 166 | + self.print_build_status(&mut text, status); |
| 167 | + max_width = max_width.max(text.width()); |
| 168 | + right_text = Some(text); |
158 | 169 | }
|
159 | 170 |
|
160 | 171 | let mut prev_text = None;
|
@@ -453,7 +464,7 @@ impl UiView for FunctionDiffUi {
|
453 | 464 | }
|
454 | 465 | (Some((_l, _ls, ld)), None) => ld.instruction_rows.len(),
|
455 | 466 | (None, Some((_r, _rs, rd))) => rd.instruction_rows.len(),
|
456 |
| - (None, None) => bail!("Symbol not found: {}", self.symbol_name), |
| 467 | + (None, None) => 0, |
457 | 468 | };
|
458 | 469 | self.left_sym = left_sym;
|
459 | 470 | self.right_sym = right_sym;
|
@@ -596,6 +607,18 @@ impl FunctionDiffUi {
|
596 | 607 | }
|
597 | 608 | }
|
598 | 609 | }
|
| 610 | + |
| 611 | + fn print_build_status<'a>(&self, out: &mut Text<'a>, status: &'a BuildStatus) { |
| 612 | + if !status.cmdline.is_empty() { |
| 613 | + out.lines.push(Line::styled(status.cmdline.clone(), Style::new().fg(Color::LightBlue))); |
| 614 | + } |
| 615 | + for line in status.stdout.lines() { |
| 616 | + out.lines.push(Line::styled(line, Style::new().fg(Color::White))); |
| 617 | + } |
| 618 | + for line in status.stderr.lines() { |
| 619 | + out.lines.push(Line::styled(line, Style::new().fg(Color::Red))); |
| 620 | + } |
| 621 | + } |
599 | 622 | }
|
600 | 623 |
|
601 | 624 | pub const COLOR_ROTATION: [Color; 7] = [
|
|
0 commit comments