From 1611af2901ff88fe68b9d8eedbc50046801eec8c Mon Sep 17 00:00:00 2001 From: hl-valdemar Date: Sun, 11 Oct 2026 01:28:58 +0200 Subject: [PATCH] fix: tighten diff gap stripes on the normal background --- docs/editing.md | 2 +- src/tui.rs | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/docs/editing.md b/docs/editing.md index c1c59e2..325a1ec 100644 --- a/docs/editing.md +++ b/docs/editing.md @@ -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. -Missing counterparts use neutral `/` stripes instead of blank rows. Each successive aligned row shifts the stripes one column left, forming continuous diagonals; the phase follows aligned row and horizontal offset so scrolling does not restart the pattern. Actual empty source lines retain their normal/change background and are not hatched. +Missing counterparts use muted `/` stripes on the normal terminal background instead of blank rows, with one space between slashes. Each successive aligned row shifts the stripes one column left, forming continuous diagonals; the phase follows aligned row and horizontal offset so scrolling does not restart the pattern. 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. diff --git a/src/tui.rs b/src/tui.rs index 5cc5bc0..2cbf9de 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -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(), "│");