summaryrefslogtreecommitdiffstats
path: root/pkg/gui/files_panel.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/files_panel.go')
-rw-r--r--pkg/gui/files_panel.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index dce047470..c244c46e8 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -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)