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

allow toggling tree view for commit files panel

This commit is contained in:
Jesse Duffield
2021-03-31 23:20:36 +11:00
parent 82fe4aa6c0
commit 8dee06f83a
4 changed files with 43 additions and 17 deletions

View File

@ -850,20 +850,13 @@ func (gui *Gui) handleToggleDirCollapsed() error {
func (gui *Gui) handleToggleFileTreeView() error {
// get path of currently selected file
node := gui.getSelectedFileChangeNode()
path := ""
if node != nil {
path = node.Path
}
path := gui.getSelectedPath()
gui.State.FileChangeManager.ToggleShowTree()
if path != "" {
gui.State.FileChangeManager.ExpandToPath(path)
}
// find that same node in the new format and move the cursor to it
if path != "" {
gui.State.FileChangeManager.ExpandToPath(path)
index, found := gui.State.FileChangeManager.GetIndexForPath(path)
if found {
gui.filesListContext().GetPanelState().SetSelectedLineIdx(index)