diff --git a/src/ViewModels/DiffContext.cs b/src/ViewModels/DiffContext.cs index 9d3486a1..6e6e9fb5 100644 --- a/src/ViewModels/DiffContext.cs +++ b/src/ViewModels/DiffContext.cs @@ -133,6 +133,14 @@ namespace SourceGit.ViewModels LoadDiffContent(); } + public void ToggleHighlightedDiffNavigation() + { + Preference.Instance.EnableChangeBlocks = !Preference.Instance.EnableChangeBlocks; + if (_content is Models.TextDiff textDiff) + textDiff.CurrentChangeBlockIdx = -1; + RefreshChangeBlockIndicator(); + } + public void IncrUnified() { UnifiedLines = _unifiedLines + 1; @@ -145,6 +153,12 @@ namespace SourceGit.ViewModels LoadDiffContent(); } + public void ToggleTwoSideDiff() + { + Preference.Instance.UseSideBySideDiff = !Preference.Instance.UseSideBySideDiff; + RefreshChangeBlockIndicator(); + } + public void OpenExternalMergeTool() { var toolType = Preference.Instance.ExternalMergeToolType; diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index 1ccee4cd..8d09272f 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -206,6 +206,12 @@ namespace SourceGit.ViewModels set => SetProperty(ref _useFullTextDiff, value); } + public bool EnableChangeBlocks + { + get => _enableChangeBlocks; + set => SetProperty(ref _enableChangeBlocks, value); + } + public Models.ChangeViewMode UnstagedChangeViewMode { get => _unstagedChangeViewMode; @@ -614,6 +620,7 @@ namespace SourceGit.ViewModels private bool _enableDiffViewWordWrap = false; private bool _showHiddenSymbolsInDiffView = false; private bool _useFullTextDiff = false; + private bool _enableChangeBlocks = 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 e904f4a4..bf7b0339 100644 --- a/src/Views/DiffView.axaml +++ b/src/Views/DiffView.axaml @@ -34,6 +34,15 @@ + + + + - + + + + + + + +