1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Set SelectedPath to SelectedCommitFilePath in CommitFiles context

This commit is contained in:
Stefan Haller
2024-08-07 21:28:45 +02:00
parent 22f0d9cdd3
commit 7fb758cc1d
3 changed files with 54 additions and 2 deletions

View File

@ -193,9 +193,16 @@ func (self *SessionStateLoader) call() *SessionState {
selectedCommit = selectedSubCommit
}
selectedPath := self.c.Contexts().Files.GetSelectedPath()
selectedCommitFilePath := self.c.Contexts().CommitFiles.GetSelectedPath()
if self.c.Context().IsCurrent(self.c.Contexts().CommitFiles) {
selectedPath = selectedCommitFilePath
}
return &SessionState{
SelectedFile: fileShimFromModelFile(self.c.Contexts().Files.GetSelectedFile()),
SelectedPath: self.c.Contexts().Files.GetSelectedPath(),
SelectedPath: selectedPath,
SelectedLocalCommit: selectedLocalCommit,
SelectedReflogCommit: selectedReflogCommit,
SelectedSubCommit: selectedSubCommit,
@ -206,7 +213,7 @@ func (self *SessionStateLoader) call() *SessionState {
SelectedTag: tagShimFromModelRemote(self.c.Contexts().Tags.GetSelected()),
SelectedStashEntry: stashEntryShimFromModelRemote(self.c.Contexts().Stash.GetSelected()),
SelectedCommitFile: commitFileShimFromModelRemote(self.c.Contexts().CommitFiles.GetSelectedFile()),
SelectedCommitFilePath: self.c.Contexts().CommitFiles.GetSelectedPath(),
SelectedCommitFilePath: selectedCommitFilePath,
SelectedWorktree: worktreeShimFromModelRemote(self.c.Contexts().Worktrees.GetSelected()),
CheckedOutBranch: branchShimFromModelBranch(self.refsHelper.GetCheckedOutRef()),
}