mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
refactor: use bindings instead of sync manually
This commit is contained in:
parent
e432559a5e
commit
54ef9c0bf7
3 changed files with 2 additions and 14 deletions
|
@ -63,8 +63,8 @@ namespace SourceGit.Models
|
||||||
{
|
{
|
||||||
public string File { get; set; } = string.Empty;
|
public string File { get; set; } = string.Empty;
|
||||||
public List<TextDiffLine> Lines { get; set; } = new List<TextDiffLine>();
|
public List<TextDiffLine> Lines { get; set; } = new List<TextDiffLine>();
|
||||||
|
public Vector SyncScrollOffset { get; set; } = Vector.Zero;
|
||||||
public int MaxLineNumber = 0;
|
public int MaxLineNumber = 0;
|
||||||
public Vector SyncScrollOffset = Vector.Zero;
|
|
||||||
|
|
||||||
public void GenerateNewPatchFromSelection(Change change, string fileBlobGuid, TextDiffSelection selection, bool revert, string output)
|
public void GenerateNewPatchFromSelection(Change change, string fileBlobGuid, TextDiffSelection selection, bool revert, string output)
|
||||||
{
|
{
|
||||||
|
|
|
@ -224,6 +224,7 @@
|
||||||
<!-- Text Diff -->
|
<!-- Text Diff -->
|
||||||
<DataTemplate DataType="m:TextDiff">
|
<DataTemplate DataType="m:TextDiff">
|
||||||
<v:TextDiffView TextDiff="{Binding}"
|
<v:TextDiffView TextDiff="{Binding}"
|
||||||
|
SyncScrollOffset="{Binding SyncScrollOffset, Mode=TwoWay}"
|
||||||
UseSideBySideDiff="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSideBySideDiff, Mode=OneWay}"/>
|
UseSideBySideDiff="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSideBySideDiff, Mode=OneWay}"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
|
|
|
@ -1169,19 +1169,11 @@ namespace SourceGit.Views
|
||||||
if (change.Property == TextDiffProperty)
|
if (change.Property == TextDiffProperty)
|
||||||
{
|
{
|
||||||
if (TextDiff == null)
|
if (TextDiff == null)
|
||||||
{
|
|
||||||
Content = null;
|
Content = null;
|
||||||
}
|
|
||||||
else if (UseSideBySideDiff)
|
else if (UseSideBySideDiff)
|
||||||
{
|
|
||||||
Content = new ViewModels.TwoSideTextDiff(TextDiff);
|
Content = new ViewModels.TwoSideTextDiff(TextDiff);
|
||||||
SyncScrollOffset = TextDiff.SyncScrollOffset;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Content = TextDiff;
|
Content = TextDiff;
|
||||||
SyncScrollOffset = TextDiff.SyncScrollOffset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (change.Property == UseSideBySideDiffProperty)
|
else if (change.Property == UseSideBySideDiffProperty)
|
||||||
{
|
{
|
||||||
|
@ -1194,11 +1186,6 @@ namespace SourceGit.Views
|
||||||
else
|
else
|
||||||
Content = TextDiff;
|
Content = TextDiff;
|
||||||
}
|
}
|
||||||
else if (change.Property == SyncScrollOffsetProperty)
|
|
||||||
{
|
|
||||||
if (TextDiff != null)
|
|
||||||
TextDiff.SyncScrollOffset = SyncScrollOffset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Models.TextDiffSelection GetUnifiedSelection(int startLine, int endLine, bool isOldSide)
|
private Models.TextDiffSelection GetUnifiedSelection(int startLine, int endLine, bool isOldSide)
|
||||||
|
|
Loading…
Reference in a new issue