mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-21 18:35:00 +00:00
feature: update blame data when clicking/navigating commits (#1408)
* initial work on allowing navigation by clicking on commits in the blame window * cleanup
This commit is contained in:
parent
11a46dbc93
commit
0ea4021a64
3 changed files with 108 additions and 9 deletions
|
@ -42,8 +42,24 @@
|
|||
</Grid>
|
||||
|
||||
<!-- File -->
|
||||
<Border Grid.Row="1" Padding="8,0">
|
||||
<TextBlock Text="{Binding Title}" VerticalAlignment="Center"/>
|
||||
<Border Grid.Row="1" Padding="8,0" >
|
||||
<Grid>
|
||||
<TextBlock Text="{Binding Title}" VerticalAlignment="Center"/>
|
||||
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<Button Classes="icon_button"
|
||||
IsEnabled="{Binding CanMoveBack}"
|
||||
Width="28"
|
||||
Click="HistoryBack">
|
||||
<Path Width="12" Height="12" Stretch="Uniform" Data="{StaticResource Icons.TriangleLeft}"/>
|
||||
</Button>
|
||||
<Button Classes="icon_button"
|
||||
IsEnabled="{Binding CanMoveForward}"
|
||||
Width="28"
|
||||
Click="HistoryForward">
|
||||
<Path Width="12" Height="12" Stretch="Uniform" Data="{StaticResource Icons.TriangleRight}"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Body -->
|
||||
|
|
|
@ -225,7 +225,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
if (DataContext is ViewModels.Blame blame)
|
||||
{
|
||||
blame.NavigateToCommit(info.CommitSHA);
|
||||
blame.NavigateToCommit(info.CommitSHA, true);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
@ -433,6 +433,8 @@ namespace SourceGit.Views
|
|||
public Blame()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
AddHandler(PointerReleasedEvent, MouseUpHandler, handledEventsToo: true);
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
|
@ -440,5 +442,32 @@ namespace SourceGit.Views
|
|||
base.OnClosed(e);
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
private void HistoryBack(object _, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.Blame blame)
|
||||
{
|
||||
blame.Back();
|
||||
}
|
||||
}
|
||||
private void HistoryForward(object _, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.Blame blame)
|
||||
{
|
||||
blame.Forward();
|
||||
}
|
||||
}
|
||||
|
||||
private void MouseUpHandler(object sender, PointerReleasedEventArgs e)
|
||||
{
|
||||
if (e.InitialPressMouseButton == MouseButton.XButton1)
|
||||
{
|
||||
HistoryBack(null, null);
|
||||
}
|
||||
else if (e.InitialPressMouseButton == MouseButton.XButton2)
|
||||
{
|
||||
HistoryForward(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue