diff --git a/src/Views/DiffView.axaml.cs b/src/Views/DiffView.axaml.cs index 7184ec44..7f7c91f2 100644 --- a/src/Views/DiffView.axaml.cs +++ b/src/Views/DiffView.axaml.cs @@ -11,30 +11,48 @@ namespace SourceGit.Views InitializeComponent(); } + public bool UseChangeBlocks { get; set; } = true; + private void OnGotoPrevChange(object _, RoutedEventArgs e) { - var textDiff = this.FindDescendantOfType(); - if (textDiff == null) - return; + if (UseChangeBlocks) + { + if (DataContext is ViewModels.DiffContext diffCtx) + diffCtx.PrevChange(); + } + else + { + var textDiff = this.FindDescendantOfType(); + if (textDiff == null) + return; - textDiff.GotoPrevChange(); - if (textDiff is SingleSideTextDiffPresenter presenter) - presenter.ForceSyncScrollOffset(); + textDiff.GotoPrevChange(); + if (textDiff is SingleSideTextDiffPresenter presenter) + presenter.ForceSyncScrollOffset(); - e.Handled = true; + e.Handled = true; + } } private void OnGotoNextChange(object _, RoutedEventArgs e) { - var textDiff = this.FindDescendantOfType(); - if (textDiff == null) - return; + if (UseChangeBlocks) + { + if (DataContext is ViewModels.DiffContext diffCtx) + diffCtx.NextChange(); + } + else + { + var textDiff = this.FindDescendantOfType(); + if (textDiff == null) + return; - textDiff.GotoNextChange(); - if (textDiff is SingleSideTextDiffPresenter presenter) - presenter.ForceSyncScrollOffset(); + textDiff.GotoNextChange(); + if (textDiff is SingleSideTextDiffPresenter presenter) + presenter.ForceSyncScrollOffset(); - e.Handled = true; + e.Handled = true; + } } } }