mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
fix: select file with only eol changes after other change types will not update diff result
This commit is contained in:
parent
a6103b8b31
commit
0fadab2ca2
3 changed files with 17 additions and 15 deletions
|
@ -380,8 +380,6 @@ namespace SourceGit.Models
|
||||||
|
|
||||||
private bool ProcessIndicatorForPatch(StringBuilder builder, TextDiffLine indicator, int idx, int start, int end, int ignoreRemoves, int ignoreAdds, bool revert, bool tailed)
|
private bool ProcessIndicatorForPatch(StringBuilder builder, TextDiffLine indicator, int idx, int start, int end, int ignoreRemoves, int ignoreAdds, bool revert, bool tailed)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var match = indicatorRegex().Match(indicator.Content);
|
var match = indicatorRegex().Match(indicator.Content);
|
||||||
var oldStart = int.Parse(match.Groups[1].Value);
|
var oldStart = int.Parse(match.Groups[1].Value);
|
||||||
var newStart = int.Parse(match.Groups[2].Value) + ignoreRemoves - ignoreAdds;
|
var newStart = int.Parse(match.Groups[2].Value) + ignoreRemoves - ignoreAdds;
|
||||||
|
@ -449,7 +447,6 @@ namespace SourceGit.Models
|
||||||
|
|
||||||
private bool ProcessIndicatorForPatchSingleSide(StringBuilder builder, TextDiffLine indicator, int idx, int start, int end, int ignoreRemoves, int ignoreAdds, bool revert, bool isOldSide, bool tailed)
|
private bool ProcessIndicatorForPatchSingleSide(StringBuilder builder, TextDiffLine indicator, int idx, int start, int end, int ignoreRemoves, int ignoreAdds, bool revert, bool isOldSide, bool tailed)
|
||||||
{
|
{
|
||||||
|
|
||||||
var match = indicatorRegex().Match(indicator.Content);
|
var match = indicatorRegex().Match(indicator.Content);
|
||||||
var oldStart = int.Parse(match.Groups[1].Value);
|
var oldStart = int.Parse(match.Groups[1].Value);
|
||||||
var newStart = int.Parse(match.Groups[2].Value) + ignoreRemoves - ignoreAdds;
|
var newStart = int.Parse(match.Groups[2].Value) + ignoreRemoves - ignoreAdds;
|
||||||
|
@ -550,6 +547,10 @@ namespace SourceGit.Models
|
||||||
public long NewSize { get; set; } = 0;
|
public long NewSize { get; set; } = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class NoOrEOLChange
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public class DiffResult
|
public class DiffResult
|
||||||
{
|
{
|
||||||
public bool IsBinary { get; set; } = false;
|
public bool IsBinary { get; set; } = false;
|
||||||
|
|
|
@ -131,6 +131,7 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Content = new Models.NoOrEOLChange();
|
||||||
IsTextDiff = false;
|
IsTextDiff = false;
|
||||||
IsNoChange = true;
|
IsNoChange = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,18 +52,6 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- Same Page -->
|
|
||||||
<Border Grid.Row="1" Background="{DynamicResource Brush.Window}" IsVisible="{Binding IsNoChange}">
|
|
||||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
|
|
||||||
<Path Width="64" Height="64" Data="{StaticResource Icons.Check}" Fill="{DynamicResource Brush.FG2}"/>
|
|
||||||
<TextBlock Margin="0,16,0,0"
|
|
||||||
Text="{DynamicResource Text.Diff.NoChange}"
|
|
||||||
FontSize="18" FontWeight="Bold"
|
|
||||||
Foreground="{DynamicResource Brush.FG2}"
|
|
||||||
HorizontalAlignment="Center"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- Diff Contents -->
|
<!-- Diff Contents -->
|
||||||
<ContentControl Grid.Row="1" Content="{Binding Content}">
|
<ContentControl Grid.Row="1" Content="{Binding Content}">
|
||||||
<ContentControl.DataTemplates>
|
<ContentControl.DataTemplates>
|
||||||
|
@ -125,6 +113,18 @@
|
||||||
<DataTemplate DataType="m:TextDiff">
|
<DataTemplate DataType="m:TextDiff">
|
||||||
<v:TextDiffView TextDiff="{Binding}" UseSideBySideDiff="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSideBySideDiff, Mode=OneWay}"/>
|
<v:TextDiffView TextDiff="{Binding}" UseSideBySideDiff="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSideBySideDiff, Mode=OneWay}"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
|
<!-- No or only EOL changes -->
|
||||||
|
<DataTemplate DataType="m:NoOrEOLChange">
|
||||||
|
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
|
||||||
|
<Path Width="64" Height="64" Data="{StaticResource Icons.Check}" Fill="{DynamicResource Brush.FG2}"/>
|
||||||
|
<TextBlock Margin="0,16,0,0"
|
||||||
|
Text="{DynamicResource Text.Diff.NoChange}"
|
||||||
|
FontSize="18" FontWeight="Bold"
|
||||||
|
Foreground="{DynamicResource Brush.FG2}"
|
||||||
|
HorizontalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
</ContentControl.DataTemplates>
|
</ContentControl.DataTemplates>
|
||||||
</ContentControl>
|
</ContentControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
Loading…
Reference in a new issue