feat: select next and previous files when staging chunks #2028
+69
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a rework of #2022
Old Behavior: When staging chunks/hunks, there was only working copy refresh which which caused a loss of selection when staging the last chunk of the file. (same for unstaging and discarding).
New Beahvior: We check whether the staged/unstaged/discarded chunk was the last change off the file. If yes, we forward the request to select the next file through the visual tree.
Logic-wise this change does not change the behavior of how SourceGit select files. Unfortunately the ViewModels of the
ChangeCollectionVieware constructed in the specific views and are not part of the general ViewModel tree.Theoretically following architectural change would be possible:
ChangeCollectionView.GetNextChangeWithoutSelectionto theViewModels.ChangeCollectionAsTree,ViewModels.ChangeCollectionAsGridandViewModels.ChangeCollectionAsList(introducing a base interface with this method).CollectionChangeView.UpdateDataSourceintoViewModels.WorkingCopyand bind to the constructed viewmodels inWorkingCopy.axamlrepo.SelectedViewfor aViewModels.WorkingCopyOr alternatively
RoutedEventscould be used for decoupling.Please let me know which path is the most desirable and I'll update things accordingly.