Auto-select first file for DiffView, whenever context is set or changed
Closed this issue ยท 4 comments
There is an unnecessary click whenever the "Select file to view changes" (DiffView) panel is/becomes visible and/or the selected context is changed.
It would be much preferable to always auto-select the first file (diff) from the list (whenever there is no active selection already), both on entering/activating the diff panel and when changing its selected context. (NOTE: This means the Text.Diff.Welcome string should be changed from "Select file to view changes" to "No changes available" or similar, since it would only be shown if the file list is empty.)
This sort of auto-selection is what we're used to from other tools (Plastic SCM, GitHub Desktop, Fork, Git Extensions, Tower, Sourcetree etc).
All the 5 DiffView instances would benefit from auto-selection:
- On the CHANGES tab-link-page in HISTORY view.
- On the
RevisionComparepage in HISTORY view (i.e when exactly 2 commits are multi-selected). In the LOCAL CHANGES view - auto-select from non-empty list of UNSTAGED or STAGED (in whatever order would make more sense).- In the STASHES view, when changing the selected stash.
(NOTE: Should also auto-select the first stash when entering!) - In the "Branch Compare" window.
Related:
When going back from multi-selection to single-selection in HISTORY view, the previously active tab-link-page (INFORMATION / CHANGES / FILES) should be preserved, instead of reverting to the first tab-link-page (INFORMATION) !
Thanks, I contributed to the discussion in #754. This feature is oft-requested and could be implemented as an optional one (via Preferences).
Awesome, thanks a lot! ๐ฅณ
Comments after testing:
- The first file-change is now auto-selected on CHANGES page when changing selected commit in HISTORY view (and RevisionCompare when selecting 2 commits), in STASHES view when changing selected Stash, and finally when choosing "Compare with HEAD/Worktree" on a branch/commit. This is perfect! ๐
- I realize now that the LOCAL CHANGES view already remembers its currently selected Unstaged/Staged file-change (after initial selection). Likewise, the STASHES view already remembers its current Stash (after initial selection). These are remembered per each repo-tab in the current session, so with your current fix (for auto-selection on Stash change) it now works great! (I don't mind so much an extra click on session startup, it was primarily the repeated extra clicks within an ongoing session that bothered me.)
- The selected details page (INFORMATION / CHANGES / FILES) is now remembered per repo-tab (in current session), even after switching between single-/pair-/multi-selection in the graph/log. Excellent! ๐
- (The
Text.Diff.Welcomestring does not need to be changed (as I first suggested), it still works fine even if the list of file-changes are empty.) - I consider this ticket Completed. ๐
(And the way this is implemented, it could easily be made an optional (by Preference) feature, if desired, in a future update.) ๐