MCPcopy Create free account
hub / github.com/Eeive/Evcode-ide / draw_diff_view

Function draw_diff_view

src/ui/overlays.rs:250–283  ·  view source on GitHub ↗
(f: &mut Frame, area: Rect, app: &App, colors: &Colors)

Source from the content-addressed store, hash-verified

248}
249
250pub fn draw_diff_view(f: &mut Frame, area: Rect, app: &App, colors: &Colors) {
251 let popup_area = Rect {
252 x: area.x + 2,
253 y: area.y + 2,
254 width: area.width.saturating_sub(4),
255 height: area.height.saturating_sub(6),
256 };
257
258 f.render_widget(Clear, popup_area);
259
260 let mut lines = Vec::new();
261 if let Some(diff) = &app.snap_diff {
262 for line in diff {
263 match line {
264 DiffLine::Unchanged(s) => lines.push(Line::from(Span::styled(format!(" {s}"), Style::default().fg(colors.muted)))),
265 DiffLine::Added(s) => lines.push(Line::from(Span::styled(format!("+ {s}"), Style::default().fg(ratatui::style::Color::Green)))),
266 DiffLine::Removed(s) => lines.push(Line::from(Span::styled(format!("- {s}"), Style::default().fg(colors.error)))),
267 }
268 }
269 } else {
270 lines.push(Line::from("Snapshot not found or no changes."));
271 }
272
273 let block = Block::default()
274 .borders(Borders::ALL)
275 .border_style(Style::default().fg(colors.accent))
276 .title(Span::styled(" Snapshot Comparison (Alt+D - close) ", Style::default().fg(colors.accent)));
277
278 let para = Paragraph::new(lines)
279 .block(block)
280 .scroll((0, 0));
281
282 f.render_widget(para, popup_area);
283}

Callers 1

drawFunction · 0.85

Calls 1

titleMethod · 0.80

Tested by

no test coverage detected