fix: tighten diff gap stripes on the normal background

This commit is contained in:
2026-10-11 01:28:58 +02:00
parent db5d417a17
commit 1611af2901
2 changed files with 9 additions and 15 deletions
+8 -14
View File
@@ -1293,12 +1293,10 @@ fn draw_diff_pane(
);
let index = if before { row.before } else { row.after };
let Some(index) = index else {
let style = Style::default()
.fg(Color::Rgb(72, 72, 72))
.bg(Color::Rgb(28, 28, 28));
let style = Style::default().fg(Color::Rgb(72, 72, 72)).bg(Color::Reset);
let buffer = frame.buffer_mut();
for x in 0..content.width {
let slash = (usize::from(x) % 4 + aligned_row % 4 + left % 4) % 4 == 0;
let slash = (usize::from(x) % 2 + aligned_row % 2 + left % 2) % 2 == 0;
buffer[(content.x + x, row_area.y)]
.set_symbol(if slash { "/" } else { " " })
.set_style(style);
@@ -2571,8 +2569,8 @@ mod tests {
.map(|x| {
let cell = &buffer[(x, y)];
let column = x - after.x - 1;
assert_eq!(cell.symbol(), [" ", " ", " ", "/"][usize::from(column % 4)]);
assert_eq!(cell.bg, Color::Rgb(28, 28, 28));
assert_eq!(cell.symbol(), [" ", "/"][usize::from(column % 2)]);
assert_eq!(cell.bg, Color::Reset);
assert_eq!(cell.fg, Color::Rgb(72, 72, 72));
cell.symbol().to_owned()
})
@@ -2622,13 +2620,9 @@ mod tests {
for x in before.x + 1..before.right() - 1 {
let column = x - before.x - 1;
let cell = &buffer[(x, y)];
let pattern = if offset == 0 {
["/", " ", " ", " "]
} else {
[" ", " ", " ", "/"]
};
assert_eq!(cell.symbol(), pattern[usize::from(column % 4)]);
assert_eq!(cell.bg, Color::Rgb(28, 28, 28));
let pattern = if offset == 0 { ["/", " "] } else { [" ", "/"] };
assert_eq!(cell.symbol(), pattern[usize::from(column % 2)]);
assert_eq!(cell.bg, Color::Reset);
assert_eq!(cell.fg, Color::Rgb(72, 72, 72));
}
assert_eq!(buffer[(after.x + 1, y)].symbol(), (offset + 1).to_string());
@@ -2650,7 +2644,7 @@ mod tests {
let column = x - before.x - 1;
assert_eq!(
buffer[(x, before.y + 1)].symbol(),
[" ", " ", "/", " "][usize::from(column % 4)],
["/", " "][usize::from(column % 2)],
);
}
assert_eq!(buffer[(before.x, before.y + 1)].symbol(), "│");