feat: default diffs to branch changes
This commit is contained in:
+13
-6
@@ -2343,7 +2343,7 @@ fn draw_diff(
|
||||
} else {
|
||||
"After"
|
||||
};
|
||||
let title = format!(" Diff · Choose {stage} ");
|
||||
let title = format!(" Diff · Choose {stage} · {} ", diff.comparison_mode.label());
|
||||
let content = diff_panel(frame, panel, &title, "", "", true);
|
||||
let notice = diff.error.as_deref().or_else(|| {
|
||||
if diff.loading {
|
||||
@@ -2381,7 +2381,11 @@ fn draw_diff(
|
||||
.as_ref()
|
||||
.map_or("not selected", |revision| revision.label.as_str());
|
||||
frame.render_widget(
|
||||
Paragraph::new(format!("Choose {stage} · Before: {}", display_text(before))),
|
||||
Paragraph::new(format!(
|
||||
"{} · Ctrl+b toggle · Before: {}",
|
||||
diff.comparison_mode.label(),
|
||||
display_text(before)
|
||||
)),
|
||||
stage_area,
|
||||
);
|
||||
if let Some(catalog) = &diff.catalog {
|
||||
@@ -2869,7 +2873,7 @@ fn diff_pane_panel(
|
||||
return area;
|
||||
}
|
||||
let title = file.map_or_else(
|
||||
|| " Diff ".into(),
|
||||
|| format!(" Diff · {} ", diff.comparison_mode.label()),
|
||||
|file| {
|
||||
let label = if diff.view_mode == ViewMode::Unified {
|
||||
if before {
|
||||
@@ -2888,9 +2892,10 @@ fn diff_pane_panel(
|
||||
&file.path
|
||||
};
|
||||
format!(
|
||||
" {label} · {} · {} ",
|
||||
" {label} · {} · {} · {} ",
|
||||
diff_status(file.status),
|
||||
display_text(&path.to_string_lossy())
|
||||
display_text(&path.to_string_lossy()),
|
||||
diff.comparison_mode.label()
|
||||
)
|
||||
},
|
||||
);
|
||||
@@ -5179,7 +5184,9 @@ mod tests {
|
||||
assert!(text.contains("> commit-19"));
|
||||
diff.handle(Input::Enter);
|
||||
render_diff(&mut terminal, &diff, &mut panels);
|
||||
assert!(screen_text(&terminal).contains("Choose After · Before: commit-19"));
|
||||
let text = screen_text(&terminal);
|
||||
assert!(text.contains("Choose After"));
|
||||
assert!(text.contains("Branch changes · Ctrl+b toggle · Before: commit-19"));
|
||||
assert!(screen_text(&terminal).contains("Tab categories"));
|
||||
assert!(screen_text(&terminal).contains("Enter select"));
|
||||
diff.handle(Input::Ctrl('u'));
|
||||
|
||||
Reference in New Issue
Block a user