From 54ef9c0bf7f1b6e9fb9260ff294aa18ba0edd156 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 6 Jun 2024 10:01:14 +0800 Subject: [PATCH] refactor: use bindings instead of sync manually --- src/Models/DiffResult.cs | 2 +- src/Views/DiffView.axaml | 1 + src/Views/TextDiffView.axaml.cs | 13 ------------- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/Models/DiffResult.cs b/src/Models/DiffResult.cs index d99c7a0e..3cc33f59 100644 --- a/src/Models/DiffResult.cs +++ b/src/Models/DiffResult.cs @@ -63,8 +63,8 @@ namespace SourceGit.Models { public string File { get; set; } = string.Empty; public List Lines { get; set; } = new List(); + public Vector SyncScrollOffset { get; set; } = Vector.Zero; public int MaxLineNumber = 0; - public Vector SyncScrollOffset = Vector.Zero; public void GenerateNewPatchFromSelection(Change change, string fileBlobGuid, TextDiffSelection selection, bool revert, string output) { diff --git a/src/Views/DiffView.axaml b/src/Views/DiffView.axaml index adffabda..96af72cb 100644 --- a/src/Views/DiffView.axaml +++ b/src/Views/DiffView.axaml @@ -224,6 +224,7 @@ diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index fc1bc211..0edfd47f 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -1169,19 +1169,11 @@ namespace SourceGit.Views if (change.Property == TextDiffProperty) { if (TextDiff == null) - { Content = null; - } else if (UseSideBySideDiff) - { Content = new ViewModels.TwoSideTextDiff(TextDiff); - SyncScrollOffset = TextDiff.SyncScrollOffset; - } else - { Content = TextDiff; - SyncScrollOffset = TextDiff.SyncScrollOffset; - } } else if (change.Property == UseSideBySideDiffProperty) { @@ -1194,11 +1186,6 @@ namespace SourceGit.Views else Content = TextDiff; } - else if (change.Property == SyncScrollOffsetProperty) - { - if (TextDiff != null) - TextDiff.SyncScrollOffset = SyncScrollOffset; - } } private Models.TextDiffSelection GetUnifiedSelection(int startLine, int endLine, bool isOldSide)