Skip to content

Conversation

@Danielku15
Copy link

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 ChangeCollectionView are constructed in the specific views and are not part of the general ViewModel tree.

Theoretically following architectural change would be possible:

  1. Move the ChangeCollectionView.GetNextChangeWithoutSelection to the ViewModels.ChangeCollectionAsTree, ViewModels.ChangeCollectionAsGrid and ViewModels.ChangeCollectionAsList (introducing a base interface with this method).
  2. Move the CollectionChangeView.UpdateDataSource into ViewModels.WorkingCopy and bind to the constructed viewmodels in WorkingCopy.axaml
  3. Replace the "VisualTree traversal" with a "ViewModel traversal" by checking repo.SelectedView for a ViewModels.WorkingCopy

Or alternatively RoutedEvents could be used for decoupling.

Please let me know which path is the most desirable and I'll update things accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant