fix: use cell-edge diagonals for diff gap hatching

This commit is contained in:
2026-10-11 01:36:40 +02:00
parent de47bf6370
commit 5e0700bb8c
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -217,7 +217,7 @@ File rows show colored **A** (added, green), **M** (modified, yellow), **D** (re
Changed text rows use muted red backgrounds in Before and muted green backgrounds in After, including blank tails and real empty lines. Foreground colors use the editor's bundled Tree-sitter syntax highlighting, parsed independently for each snapshot and its path (including the old path for renames). Unknown languages retain the normal foreground; historical snapshots do not borrow live-buffer LSP tokens. Changed text rows use muted red backgrounds in Before and muted green backgrounds in After, including blank tails and real empty lines. Foreground colors use the editor's bundled Tree-sitter syntax highlighting, parsed independently for each snapshot and its path (including the old path for renames). Unknown languages retain the normal foreground; historical snapshots do not borrow live-buffer LSP tokens.
Missing counterparts use adjacent muted `/` stripes on the normal terminal background instead of blank rows, with a slash in every column. The dense pattern stays continuous while scrolling. Actual empty source lines retain their normal/change background and are not hatched. Missing counterparts use adjacent muted `╱` diagonals (U+2571, box drawings light diagonal) on the normal terminal background, one per column. Unlike the text slash `/`, this glyph is designed to reach cell corners so diagonals can join end to end across successive rows. Pixel-perfect joins depend on the terminal's font and line-spacing rendering. Actual empty source lines retain their normal/change background and are not hatched.
Tab/Shift+Tab cycles focus between Files, Before, and After. In text panes, Up/Down or Ctrl+j/k scrolls both panes together; Left/Right or Ctrl+h/l scrolls the focused pane horizontally. Home/End goes to the first/last tree row or aligned text row. Wheel input over a text pane scrolls both panes; over Files it navigates visible tree rows without opening them. Esc first leaves filtering when the tree is focused; otherwise it closes the diff and preserves the editor's buffers, cursors, unsaved text, and undo history. Typing and pasted text cannot edit either snapshot. Tab/Shift+Tab cycles focus between Files, Before, and After. In text panes, Up/Down or Ctrl+j/k scrolls both panes together; Left/Right or Ctrl+h/l scrolls the focused pane horizontally. Home/End goes to the first/last tree row or aligned text row. Wheel input over a text pane scrolls both panes; over Files it navigates visible tree rows without opening them. Esc first leaves filtering when the tree is focused; otherwise it closes the diff and preserves the editor's buffers, cursors, unsaved text, and undo history. Typing and pasted text cannot edit either snapshot.
+4 -4
View File
@@ -1297,7 +1297,7 @@ fn draw_diff_pane(
let buffer = frame.buffer_mut(); let buffer = frame.buffer_mut();
for x in 0..content.width { for x in 0..content.width {
buffer[(content.x + x, row_area.y)] buffer[(content.x + x, row_area.y)]
.set_symbol("/") .set_symbol("╱")
.set_style(style); .set_style(style);
} }
continue; continue;
@@ -2567,7 +2567,7 @@ mod tests {
let gap_symbols: Vec<_> = (after.x + 1..after.right() - 1) let gap_symbols: Vec<_> = (after.x + 1..after.right() - 1)
.map(|x| { .map(|x| {
let cell = &buffer[(x, y)]; let cell = &buffer[(x, y)];
assert_eq!(cell.symbol(), "/"); assert_eq!(cell.symbol(), "╱");
assert_eq!(cell.bg, Color::Reset); assert_eq!(cell.bg, Color::Reset);
assert_eq!(cell.fg, Color::Rgb(72, 72, 72)); assert_eq!(cell.fg, Color::Rgb(72, 72, 72));
cell.symbol().to_owned() cell.symbol().to_owned()
@@ -2617,7 +2617,7 @@ mod tests {
let y = before.y + 1 + offset; let y = before.y + 1 + offset;
for x in before.x + 1..before.right() - 1 { for x in before.x + 1..before.right() - 1 {
let cell = &buffer[(x, y)]; let cell = &buffer[(x, y)];
assert_eq!(cell.symbol(), "/"); assert_eq!(cell.symbol(), "╱");
assert_eq!(cell.bg, Color::Reset); assert_eq!(cell.bg, Color::Reset);
assert_eq!(cell.fg, Color::Rgb(72, 72, 72)); assert_eq!(cell.fg, Color::Rgb(72, 72, 72));
} }
@@ -2637,7 +2637,7 @@ mod tests {
render_diff(&mut terminal, &diff, &mut panels); render_diff(&mut terminal, &diff, &mut panels);
let buffer = terminal.backend().buffer(); let buffer = terminal.backend().buffer();
for x in before.x + 1..before.right() - 1 { 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(), "╱");
} }
assert_eq!(buffer[(before.x, before.y + 1)].symbol(), "│"); assert_eq!(buffer[(before.x, before.y + 1)].symbol(), "│");
assert_eq!(buffer[(before.right() - 1, before.y + 1)].symbol(), "│"); assert_eq!(buffer[(before.right() - 1, before.y + 1)].symbol(), "│");