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

move more view model logic into the files view model

This commit is contained in:
Jesse Duffield
2022-01-30 14:46:46 +11:00
parent 8ea7b7a62e
commit c084abb378
17 changed files with 392 additions and 323 deletions

View File

@ -653,20 +653,8 @@ func (self *FilesController) handleToggleDirCollapsed() error {
}
func (self *FilesController) toggleTreeView() error {
// get path of currently selected file
path := self.getSelectedPath()
self.getContext().FileTreeViewModel.ToggleShowTree()
// find that same node in the new format and move the cursor to it
if path != "" {
self.getContext().FileTreeViewModel.ExpandToPath(path)
index, found := self.getContext().FileTreeViewModel.GetIndexForPath(path)
if found {
self.getContext().GetPanelState().SetSelectedLineIdx(index)
}
}
return self.c.PostRefreshUpdate(self.getContext())
}