feat: use two-column diagonal diff hatching (EXPERIMENT; DISCARDED)
This commit is contained in:
+29
-8
@@ -3310,7 +3310,7 @@ fn draw_diff_pane(
|
||||
let buffer = frame.buffer_mut();
|
||||
for x in 0..content.width {
|
||||
buffer[(content.x + x, row_area.y)]
|
||||
.set_symbol("╱")
|
||||
.set_symbol(["", ""][usize::from(x % 2)])
|
||||
.set_style(style);
|
||||
}
|
||||
continue;
|
||||
@@ -5353,7 +5353,7 @@ mod tests {
|
||||
if scope == WhitespaceScope::All { 8 } else { 4 },
|
||||
);
|
||||
if mode == ViewMode::Split {
|
||||
assert!(buffer.content.iter().any(|cell| cell.symbol() == "╱"));
|
||||
assert!(buffer.content.iter().any(|cell| cell.symbol() == ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6479,7 +6479,7 @@ mod tests {
|
||||
pane_screen(&terminal, Rect::new(present.right() - 13, present.y, 12, 1),)
|
||||
.contains(if added { "editable" } else { "read-only" })
|
||||
);
|
||||
assert!(!text.contains('╱'));
|
||||
assert!(!text.contains(['', '']));
|
||||
}
|
||||
let mut empty_added = deletion_file();
|
||||
empty_added.status = FileStatus::Added;
|
||||
@@ -6541,7 +6541,7 @@ mod tests {
|
||||
.contains("old revision → Working checkout")
|
||||
);
|
||||
assert!(!text.contains("unchanged rename content"));
|
||||
assert!(!text.contains('╱'));
|
||||
assert!(!text.contains(['', '']));
|
||||
|
||||
let mut modified = diff_comparison(vec![deletion_file()]);
|
||||
modified.files_visible = false;
|
||||
@@ -6802,7 +6802,14 @@ mod tests {
|
||||
let gap_symbols: Vec<_> = (after.x + 1..after.right() - 1)
|
||||
.map(|x| {
|
||||
let cell = &buffer[(x, y)];
|
||||
assert_eq!(cell.symbol(), "╱");
|
||||
assert_eq!(
|
||||
cell.symbol(),
|
||||
if (x - after.x - 1) % 2 == 0 {
|
||||
""
|
||||
} else {
|
||||
""
|
||||
}
|
||||
);
|
||||
assert_eq!(cell.bg, Color::Reset);
|
||||
assert_eq!(cell.fg, buffer[(after.x + 1, y + 1)].fg);
|
||||
cell.symbol().to_owned()
|
||||
@@ -6858,7 +6865,14 @@ mod tests {
|
||||
let y = before.y + 1 + offset;
|
||||
for x in before.x + 1..before.right() - 1 {
|
||||
let cell = &buffer[(x, y)];
|
||||
assert_eq!(cell.symbol(), "╱");
|
||||
assert_eq!(
|
||||
cell.symbol(),
|
||||
if (x - before.x - 1) % 2 == 0 {
|
||||
""
|
||||
} else {
|
||||
""
|
||||
}
|
||||
);
|
||||
assert_eq!(cell.bg, Color::Reset);
|
||||
}
|
||||
assert_eq!(buffer[(after.x + 1, y)].symbol(), (offset + 1).to_string());
|
||||
@@ -6876,7 +6890,14 @@ mod tests {
|
||||
render_diff(&mut terminal, &diff, &mut panels);
|
||||
let buffer = terminal.backend().buffer();
|
||||
for x in before.x + 1..before.right() - 1 {
|
||||
assert_eq!(buffer[(x, before.y + 1)].symbol(), "╱");
|
||||
assert_eq!(
|
||||
buffer[(x, before.y + 1)].symbol(),
|
||||
if (x - before.x - 1) % 2 == 0 {
|
||||
""
|
||||
} else {
|
||||
""
|
||||
}
|
||||
);
|
||||
}
|
||||
assert_eq!(buffer[(before.x, before.y + 1)].symbol(), "│");
|
||||
assert_eq!(buffer[(before.right() - 1, before.y + 1)].symbol(), "│");
|
||||
@@ -10751,7 +10772,7 @@ end
|
||||
vec!["3", "3", "end"]
|
||||
]
|
||||
);
|
||||
assert!(!lines.iter().any(|line| line.contains('╱')));
|
||||
assert!(!lines.iter().any(|line| line.contains(['', ''])));
|
||||
editor.handle(Input::Char('\t'));
|
||||
render_native_diff(&mut terminal, &mut views, &mut editor);
|
||||
let geometry = views.panels.diff.as_ref().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user