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:
@ -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())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user