enhance: only raise BlockNavigationChangedEvent when UseBlockNavigation enabled

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-03-21 18:00:46 +08:00
parent 9590f96a44
commit d335cac167
No known key found for this signature in database
2 changed files with 12 additions and 6 deletions

View file

@ -1746,25 +1746,25 @@ namespace SourceGit.Views
public void GotoFirstChange()
{
this.FindDescendantOfType<ThemedTextDiffPresenter>()?.GotoFirstChange();
RaiseEvent(new RoutedEventArgs(BlockNavigationChangedEvent));
TryRaiseBlockNavigationChanged();
}
public void GotoPrevChange()
{
this.FindDescendantOfType<ThemedTextDiffPresenter>()?.GotoPrevChange();
RaiseEvent(new RoutedEventArgs(BlockNavigationChangedEvent));
TryRaiseBlockNavigationChanged();
}
public void GotoNextChange()
{
this.FindDescendantOfType<ThemedTextDiffPresenter>()?.GotoNextChange();
RaiseEvent(new RoutedEventArgs(BlockNavigationChangedEvent));
TryRaiseBlockNavigationChanged();
}
public void GotoLastChange()
{
this.FindDescendantOfType<ThemedTextDiffPresenter>()?.GotoLastChange();
RaiseEvent(new RoutedEventArgs(BlockNavigationChangedEvent));
TryRaiseBlockNavigationChanged();
}
protected override void OnDataContextChanged(EventArgs e)
@ -1818,7 +1818,7 @@ namespace SourceGit.Views
else
BlockNavigation = null;
RaiseEvent(new RoutedEventArgs(BlockNavigationChangedEvent));
TryRaiseBlockNavigationChanged();
}
private void OnStageChunk(object _1, RoutedEventArgs _2)
@ -1990,5 +1990,11 @@ namespace SourceGit.Views
repo.MarkWorkingCopyDirtyManually();
repo.SetWatcherEnabled(true);
}
private void TryRaiseBlockNavigationChanged()
{
if (UseBlockNavigation)
RaiseEvent(new RoutedEventArgs(BlockNavigationChangedEvent));
}
}
}