From d0c6e27fee9b4c7d944a1afd0ad30731b8566059 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sun, 28 Sep 2025 14:17:24 +0200 Subject: [PATCH] Cleanup: move variable assignment out of the loop It never changes inside this function, so there's no need to recompute it with every loop iteration. --- pkg/gui/controllers/files_controller.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index bf71bf04a..d71db5c3f 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -1221,13 +1221,14 @@ func normalisedSelectedNodes(selectedNodes []*filetree.FileNode) []*filetree.Fil } func isDescendentOfSelectedNodes(node *filetree.FileNode, selectedNodes []*filetree.FileNode) bool { + nodePath := node.GetPath() + for _, selectedNode := range selectedNodes { if selectedNode.IsFile() { continue } selectedNodePath := selectedNode.GetPath() - nodePath := node.GetPath() if strings.HasPrefix(nodePath, selectedNodePath+"/") { return true