summaryrefslogtreecommitdiffstats
path: root/pkg/gui/files_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-03-31 23:20:36 +1100
committerJesse Duffield <jessedduffield@gmail.com>2021-04-02 11:00:15 +1100
commit8dee06f83a1aebe9eb085e67b790f166f9d205af (patch)
tree620c8ef558e6d38d82c2565ca854c0b22d1e6f0f /pkg/gui/files_panel.go
parent82fe4aa6c0e24852f4c73030447fdd99deda5e66 (diff)
allow toggling tree view for commit files panel
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)