mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
feature<TextDiffView>: do NOT reset scroll offset after recompute diff with same change
This commit is contained in:
parent
096fd6cb22
commit
2b97d7c599
5 changed files with 38 additions and 12 deletions
|
@ -1,4 +1,5 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
@ -194,6 +195,9 @@ namespace SourceGit.ViewModels {
|
|||
|
||||
// Restore last selection states.
|
||||
if (viewChange != null) {
|
||||
var scrollOffset = Vector.Zero;
|
||||
if (_detailContext is DiffContext old) scrollOffset = old.SyncScrollOffset;
|
||||
|
||||
if (lastSelectedIsUnstaged) {
|
||||
SelectedUnstagedChange = viewChange;
|
||||
SelectedUnstagedTreeNode = FileTreeNode.SelectByPath(_unstagedTree, viewFile);
|
||||
|
@ -201,6 +205,8 @@ namespace SourceGit.ViewModels {
|
|||
SelectedStagedChange = viewChange;
|
||||
SelectedStagedTreeNode = FileTreeNode.SelectByPath(_stagedTree, viewFile);
|
||||
}
|
||||
|
||||
if (_detailContext is DiffContext cur) cur.SyncScrollOffset = scrollOffset;
|
||||
} else {
|
||||
SelectedUnstagedChange = null;
|
||||
SelectedUnstagedTreeNode = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue