mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Ensure file view length is never returned as -1
This was causing issues when obtaining selected items
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
"github.com/samber/lo"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
@ -138,7 +139,8 @@ func (self *FileTree) GetAllItems() []*FileNode {
|
||||
}
|
||||
|
||||
func (self *FileTree) Len() int {
|
||||
return self.tree.Size(self.collapsedPaths) - 1 // ignoring root
|
||||
// -1 because we're ignoring the root
|
||||
return utils.Max(self.tree.Size(self.collapsedPaths)-1, 0)
|
||||
}
|
||||
|
||||
func (self *FileTree) GetItem(index int) types.HasUrn {
|
||||
|
Reference in New Issue
Block a user