feature: auto-select first change in commit details panel and revision/branch compare panel (#1019)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-02-25 10:53:42 +08:00
parent 1f35e83799
commit c6747f72f9
No known key found for this signature in database
11 changed files with 71 additions and 21 deletions

View file

@ -25,8 +25,15 @@ namespace SourceGit.ViewModels
public int ActivePageIndex
{
get => _activePageIndex;
set => SetProperty(ref _activePageIndex, value);
get => _repo.CommitDetailActivePageIndex;
set
{
if (_repo.CommitDetailActivePageIndex != value)
{
_repo.CommitDetailActivePageIndex = value;
OnPropertyChanged();
}
}
}
public Models.Commit Commit
@ -617,11 +624,7 @@ namespace SourceGit.ViewModels
_changes = null;
_revisionFiles.Clear();
FullMessage = string.Empty;
SignInfo = null;
Changes = [];
VisibleChanges = null;
SelectedChanges = null;
ViewRevisionFileContent = null;
Children.Clear();
RevisionFileSearchFilter = string.Empty;
@ -821,7 +824,6 @@ namespace SourceGit.ViewModels
};
private Repository _repo = null;
private int _activePageIndex = 0;
private Models.Commit _commit = null;
private string _fullMessage = string.Empty;
private Models.CommitSignInfo _signInfo = null;

View file

@ -453,6 +453,12 @@ namespace SourceGit.ViewModels
private set => SetProperty(ref _isAutoFetching, value);
}
public int CommitDetailActivePageIndex
{
get;
set;
} = 0;
public Repository(bool isBare, string path, string gitDir)
{
IsBare = isBare;

View file

@ -1466,7 +1466,7 @@ namespace SourceGit.ViewModels
return unstaged;
var visible = new List<Models.Change>();
foreach (var c in unstaged)
{
if (c.Path.Contains(_unstagedFilter, StringComparison.OrdinalIgnoreCase))