mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-10-23 17:48:30 +03:00
When entering a commit in path filtering mode, select the filtered path
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
)
|
||||
@@ -90,6 +92,15 @@ func (self *SwitchToDiffFilesController) enter() error {
|
||||
Scope: []types.RefreshableView{types.COMMIT_FILES},
|
||||
})
|
||||
|
||||
if filterPath := self.c.Modes().Filtering.GetPath(); filterPath != "" {
|
||||
path, err := filepath.Rel(self.c.Git().RepoPaths.RepoPath(), filterPath)
|
||||
if err != nil {
|
||||
path = filterPath
|
||||
}
|
||||
commitFilesContext.CommitFileTreeViewModel.SelectPath(
|
||||
filepath.ToSlash(path), self.c.UserConfig().Gui.ShowRootItemInFileTree)
|
||||
}
|
||||
|
||||
self.c.Context().Push(commitFilesContext, types.OnFocusOpts{})
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user