From 03b5e4ca40de1337392588a19b1c360865694117 Mon Sep 17 00:00:00 2001 From: Ahmad Ragab Date: Mon, 30 Mar 2026 16:51:52 -0400 Subject: [PATCH] fix(ui): improve diff preview for added and deleted files Added files no longer trigger broken GapView/TrailingGap context fetches. Deleted files show a "This file was deleted" banner instead of raw hunks. Status badges for Added/Deleted now render with tinted backgrounds. Footer line totals now include uncommitted/untracked files. Co-Authored-By: Claude Opus 4.6 (1M context) --- .prettierignore | 1 + src/components/ChangedFilesList.tsx | 8 ++------ src/components/ScrollingDiffView.tsx | 29 ++++++++++++++++++++++------ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.prettierignore b/.prettierignore index dd601b5e..97d7bbb8 100644 --- a/.prettierignore +++ b/.prettierignore @@ -5,6 +5,7 @@ release/ node_modules/ .worktrees/ .claude/ +.omc/ .planning/ .letta/ package-lock.json diff --git a/src/components/ChangedFilesList.tsx b/src/components/ChangedFilesList.tsx index e26de1fe..31b8bb59 100644 --- a/src/components/ChangedFilesList.tsx +++ b/src/components/ChangedFilesList.tsx @@ -115,12 +115,8 @@ export function ChangedFilesList(props: ChangedFilesListProps) { }); }); - const totalAdded = createMemo(() => - files().reduce((s, f) => s + (f.committed ? f.lines_added : 0), 0), - ); - const totalRemoved = createMemo(() => - files().reduce((s, f) => s + (f.committed ? f.lines_removed : 0), 0), - ); + const totalAdded = createMemo(() => files().reduce((s, f) => s + f.lines_added, 0)); + const totalRemoved = createMemo(() => files().reduce((s, f) => s + f.lines_removed, 0)); const uncommittedCount = createMemo(() => files().filter((f) => !f.committed).length); /** For each file, compute the display filename and an optional disambiguating directory. */ diff --git a/src/components/ScrollingDiffView.tsx b/src/components/ScrollingDiffView.tsx index fc8081f0..16de3eb8 100644 --- a/src/components/ScrollingDiffView.tsx +++ b/src/components/ScrollingDiffView.tsx @@ -1,6 +1,6 @@ import { For, Show, createSignal, createEffect, onMount, onCleanup } from 'solid-js'; import type { JSX } from 'solid-js'; -import { theme } from '../lib/theme'; +import { theme, bannerStyle } from '../lib/theme'; import { sf } from '../lib/fontScale'; import { getStatusColor } from '../lib/status-colors'; import { openFileInEditor } from '../lib/shell'; @@ -591,7 +591,10 @@ function FileSection(props: { padding: '2px 8px', 'border-radius': '4px', color: getStatusColor(props.file.status), - background: 'rgba(255,255,255,0.06)', + background: + props.file.status === 'M' + ? 'rgba(255,255,255,0.06)' + : `color-mix(in srgb, ${getStatusColor(props.file.status)} 15%, transparent)`, }} > {STATUS_LABELS[props.file.status] ?? props.file.status} @@ -672,9 +675,23 @@ function FileSection(props: { - + +
+ This file was deleted +
+
+ +
- 0 && props.file.status !== 'D'}> + 0 && props.file.status === 'M'}> {(hunk, hunkIdx) => ( <> - 0}> + 0 && props.file.status === 'M'}> )} - 0 && props.file.status !== 'D'}> + 0 && props.file.status === 'M'}>