From b9b3053051722a249ab0233b365295dcac84dbb0 Mon Sep 17 00:00:00 2001 From: mika kuns Date: Fri, 24 Jul 2026 11:21:20 +0200 Subject: [PATCH] fix(ui): clearer rename display in diff viewer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show renames as old → new in the file header and suppress the misleading "+0 −0" stats for a pure rename (the R badge already conveys it). --- src/ClaudeDo.Ui/ViewModels/Modals/DiffModels.cs | 10 +++++++++- src/ClaudeDo.Ui/Views/Modals/DiffViewerView.axaml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ClaudeDo.Ui/ViewModels/Modals/DiffModels.cs b/src/ClaudeDo.Ui/ViewModels/Modals/DiffModels.cs index 17a7d1c1..9f9dd0b5 100644 --- a/src/ClaudeDo.Ui/ViewModels/Modals/DiffModels.cs +++ b/src/ClaudeDo.Ui/ViewModels/Modals/DiffModels.cs @@ -54,6 +54,14 @@ public sealed class DiffFileViewModel /// A text file that produced no diff hunks (e.g. a newly added empty file). public bool IsEmptyContent => !IsBinary && Lines.Count == 0; + + /// A rename with no content change — showing "+0 −0" for it is misleading. + public bool IsPureRename => Status == DiffFileStatus.Renamed && Additions == 0 && Deletions == 0; + + /// Header path label: for a rename, spell out old → new; otherwise just the path. + public string HeaderPath => Status == DiffFileStatus.Renamed && !string.IsNullOrEmpty(OldPath) + ? $"{OldPath} → {Path}" + : Path; } /// One row in the planning subtask list (left pane in Planning mode). @@ -72,7 +80,7 @@ public sealed partial class DiffTreeNodeViewModel : ViewModelBase [ObservableProperty] private bool _isExpanded = true; public string? StatusCode => File?.StatusCode; - public bool ShowStats => File is { IsBinary: false }; + public bool ShowStats => File is { IsBinary: false, IsPureRename: false }; public int Additions => File?.Additions ?? 0; public int Deletions => File?.Deletions ?? 0; } diff --git a/src/ClaudeDo.Ui/Views/Modals/DiffViewerView.axaml b/src/ClaudeDo.Ui/Views/Modals/DiffViewerView.axaml index 6e19cb84..45f494d6 100644 --- a/src/ClaudeDo.Ui/Views/Modals/DiffViewerView.axaml +++ b/src/ClaudeDo.Ui/Views/Modals/DiffViewerView.axaml @@ -131,7 +131,7 @@ FontFamily="{DynamicResource MonoFont}" FontSize="{StaticResource FontSizeEyebrow}" Foreground="{DynamicResource TextBrush}"/> -