From 05e2936abfc2418399a1aed52f213eff4b734f3c Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Wed, 4 Jun 2025 10:40:25 +0200 Subject: [PATCH] Add preference toggle icon, to diff contents of LFS files Doesn't have any functionallity yet though --- src/Resources/Locales/en_US.axaml | 1 + src/ViewModels/DiffContext.cs | 21 +++++++++++++++++++++ src/ViewModels/Preferences.cs | 7 +++++++ src/Views/DiffView.axaml | 8 ++++++++ 4 files changed, 37 insertions(+) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 765b6f8c..879fba5a 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -264,6 +264,7 @@ Ignore All Whitespace Changes Last Difference LFS OBJECT CHANGE + Show LFS Content Next Difference NO CHANGES OR ONLY EOL CHANGES Previous Difference diff --git a/src/ViewModels/DiffContext.cs b/src/ViewModels/DiffContext.cs index ce13e655..e25b4e3a 100644 --- a/src/ViewModels/DiffContext.cs +++ b/src/ViewModels/DiffContext.cs @@ -31,6 +31,20 @@ namespace SourceGit.ViewModels } } + public bool ShowContentInLFSDiff + { + get => Preferences.Instance.ShowContentInLFSDiff; + set + { + if (value != Preferences.Instance.ShowContentInLFSDiff) + { + Preferences.Instance.ShowContentInLFSDiff = value; + OnPropertyChanged(); + LoadDiffContent(); + } + } + } + public string FileModeChange { get => _fileModeChange; @@ -42,6 +56,11 @@ namespace SourceGit.ViewModels get => _isTextDiff; private set => SetProperty(ref _isTextDiff, value); } + public bool IsLFSDiff + { + get => _isLFSDiff; + private set => SetProperty(ref _isLFSDiff, value); + } public object Content { @@ -221,6 +240,7 @@ namespace SourceGit.ViewModels FileModeChange = latest.FileModeChange; Content = rs; + IsLFSDiff = latest.IsLFS; IsTextDiff = rs is Models.TextDiff; }); }); @@ -291,6 +311,7 @@ namespace SourceGit.ViewModels private string _fileModeChange = string.Empty; private int _unifiedLines = 4; private bool _isTextDiff = false; + private bool _isLFSDiff = false; private object _content = null; private Info _info = null; } diff --git a/src/ViewModels/Preferences.cs b/src/ViewModels/Preferences.cs index df6d36bd..160d8911 100644 --- a/src/ViewModels/Preferences.cs +++ b/src/ViewModels/Preferences.cs @@ -231,6 +231,12 @@ namespace SourceGit.ViewModels } } + public bool ShowContentInLFSDiff + { + get => _showContentInLFSDiff; + set => SetProperty(ref _showContentInLFSDiff, value); + } + public bool IgnoreWhitespaceChangesInDiff { get => _ignoreWhitespaceChangesInDiff; @@ -687,6 +693,7 @@ namespace SourceGit.ViewModels private bool _showHiddenSymbolsInDiffView = false; private bool _useFullTextDiff = false; private bool _useBlockNavigationInDiffView = false; + private bool _showContentInLFSDiff = false; private Models.ChangeViewMode _unstagedChangeViewMode = Models.ChangeViewMode.List; private Models.ChangeViewMode _stagedChangeViewMode = Models.ChangeViewMode.List; diff --git a/src/Views/DiffView.axaml b/src/Views/DiffView.axaml index 559ad14d..09db04d4 100644 --- a/src/Views/DiffView.axaml +++ b/src/Views/DiffView.axaml @@ -152,6 +152,14 @@ + + + +