fix(ui): clearer rename display in diff viewer

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).
This commit is contained in:
mika kuns
2026-07-24 11:21:20 +02:00
parent 671c886c75
commit b9b3053051
2 changed files with 10 additions and 2 deletions
@@ -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;
}
@@ -131,7 +131,7 @@
FontFamily="{DynamicResource MonoFont}" FontSize="{StaticResource FontSizeEyebrow}"
Foreground="{DynamicResource TextBrush}"/>
</Border>
<TextBlock Grid.Column="1" Classes="path-mono" Text="{Binding SelectedFile.Path}"
<TextBlock Grid.Column="1" Classes="path-mono" Text="{Binding SelectedFile.HeaderPath}"
VerticalAlignment="Center" TextTrimming="PrefixCharacterEllipsis"/>
</Grid>
</Border>