mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
fix: update search filter selected commit after Histories selected commit changed
This commit is contained in:
parent
65ccc9fc7b
commit
592d087e05
4 changed files with 29 additions and 0 deletions
|
@ -369,6 +369,18 @@ namespace SourceGit.ViewModels
|
|||
return menu;
|
||||
}
|
||||
|
||||
public void NotifyAutoSelectedCommitChanged()
|
||||
{
|
||||
if (DetailContext is CommitDetail detail)
|
||||
{
|
||||
_repo.HandleSelectedCommitChanged(detail.Commit);
|
||||
}
|
||||
else
|
||||
{
|
||||
_repo.HandleSelectedCommitChanged(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void FillCurrentBranchMenu(ContextMenu menu, Models.Branch current)
|
||||
{
|
||||
var submenu = new MenuItem();
|
||||
|
|
|
@ -221,6 +221,12 @@ namespace SourceGit.ViewModels
|
|||
private set => SetProperty(ref _hasUnsolvedConflicts, value);
|
||||
}
|
||||
|
||||
public Models.Commit SearchResultSelectedCommit
|
||||
{
|
||||
get => _searchResultSelectedCommit;
|
||||
set => SetProperty(ref _searchResultSelectedCommit, value);
|
||||
}
|
||||
|
||||
public void Open()
|
||||
{
|
||||
_watcher = new Models.Watcher(this);
|
||||
|
@ -1348,6 +1354,14 @@ namespace SourceGit.ViewModels
|
|||
return menu;
|
||||
}
|
||||
|
||||
public void HandleSelectedCommitChanged(Models.Commit commit)
|
||||
{
|
||||
if (SearchedCommits.Count > 0)
|
||||
{
|
||||
SearchResultSelectedCommit = commit;
|
||||
}
|
||||
}
|
||||
|
||||
private string _fullpath = string.Empty;
|
||||
private string _gitDir = string.Empty;
|
||||
private Models.GitFlow _gitflow = new Models.GitFlow();
|
||||
|
@ -1377,5 +1391,6 @@ namespace SourceGit.ViewModels
|
|||
|
||||
private InProgressContext _inProgressContext = null;
|
||||
private bool _hasUnsolvedConflicts = false;
|
||||
private Models.Commit _searchResultSelectedCommit = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -291,6 +291,7 @@ namespace SourceGit.Views
|
|||
if (DataContext is ViewModels.Histories histories)
|
||||
{
|
||||
histories.Select(commitDataGrid.SelectedItems);
|
||||
histories.NotifyAutoSelectedCommitChanged();
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
|
|
|
@ -403,6 +403,7 @@
|
|||
<DataGrid Grid.Row="1"
|
||||
ItemsSource="{Binding SearchedCommits}"
|
||||
SelectionMode="Single"
|
||||
SelectedItem="{Binding SearchResultSelectedCommit, Mode=OneWay}"
|
||||
CanUserReorderColumns="False"
|
||||
CanUserResizeColumns="False"
|
||||
CanUserSortColumns="False"
|
||||
|
|
Loading…
Reference in a new issue