fix: dim etched diff areas to match gutter text

This commit is contained in:
Valdemar Lorenzen
2026-10-13 11:03:25 +02:00
parent d7fbf9a144
commit 8c5d218c11
3 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
- [x] diff view: for split view, change split orientation (left/right vs above/below) - left/right by default.
- Space s flips orientation; configurable startup default and shared pane geometry/directional focus.
- [x] add `C` and `D` for deleting line from current cursor position (and entering insert mode: `C`); add `Y` for copying line from current cursor position; add `r` for replacing character at cursor position; add `s` for deleting character at current cursor position and entering insert mode; add `d<count>w` for deleting whole words; add `d<count>b` for deleting backwards (same as `d<count>w` but backwards).
- [ ] diff view: make foreground of etched areas (where no lines exist) the same dimmed color as the normal gutter text
- [x] diff view: make foreground of etched areas (where no lines exist) the same dimmed color as the normal gutter text
- [ ] copying is pretty slow; optimize performance to reduce latency.
- [ ] pull a pr description and display it in a buffer:
- open a selector that allows you to pick a pr from remote
+1 -1
View File
@@ -376,7 +376,7 @@ Character-wise highlighting is enabled automatically within paired changed lines
Diff backgrounds blend the terminal's default background with its red/green palette colors: an 18% accent for changed rows and a stronger 38% accent for changed characters, both computed from the original background. Read-only OSC 11/4 queries run after the initial paint, on focus regain, and whenever a subscribed DEC 2031 color-scheme notification arrives. While a diff is visible in any pane, a nonblocking one-second palette probe also catches external theme changes without a notification, including changes between two themes with the same light/dark preference. Ordinary editor views do not poll; cached colors apply across editor panes. If the complete palette is unavailable within 250 ms, change backgrounds remain normal and gutter colors/markers still identify changes.
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.
Missing counterparts use adjacent muted `╱` diagonals (U+2571, box drawings light diagonal) on the normal terminal background, one per column, with the same terminal `DarkGray` foreground as ordinary gutter text. 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.
In Normal mode, Tab/Shift+Tab cycles focus between Files and the visible text panes, skipping absent panes. Switching Before/After synchronizes the primary cursor by aligned diff row and display column. A missing counterpart uses the nearest visible source row; shorter lines clamp the column while retaining the preferred display column for the return trip. Vertical wheel input scrolls the visible panes without moving the focused text caret; switching sides by vertical wheel also synchronizes the cursor. Over Files it navigates visible tree rows without opening them. Horizontal wheel input in either split synchronizes the Before/After horizontal offsets, bounded by the longer side, without changing focus, cursor, or selections; over Files it is consumed. Added/deleted files retain single-pane scrolling. While a comparison is open, Escape cancels modes, prompts, or filtering, or returns picker focus to the last bound text pane; it leaves the comparison open. Use **`:diff.close`**, find `diff.close` in the palette, or bind **`config.core.diff.close`** to leave the comparison explicitly. The dotted command is intentional; there is no `:diffclose` alias.
+2 -3
View File
@@ -2998,7 +2998,7 @@ fn draw_diff_pane(
display_row,
);
let Some(index) = index else {
let style = Style::default().fg(Color::Rgb(72, 72, 72)).bg(Color::Reset);
let style = Style::default().fg(Color::DarkGray).bg(Color::Reset);
let buffer = frame.buffer_mut();
for x in 0..content.width {
buffer[(content.x + x, row_area.y)]
@@ -5291,7 +5291,7 @@ mod tests {
let cell = &buffer[(x, y)];
assert_eq!(cell.symbol(), "╱");
assert_eq!(cell.bg, Color::Reset);
assert_eq!(cell.fg, Color::Rgb(72, 72, 72));
assert_eq!(cell.fg, buffer[(after.x + 1, y + 1)].fg);
cell.symbol().to_owned()
})
.collect();
@@ -5347,7 +5347,6 @@ mod tests {
let cell = &buffer[(x, y)];
assert_eq!(cell.symbol(), "╱");
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());
assert_eq!(buffer[(after.x + 2, y)].symbol(), "+");