Repository: godotengine/godot (language: cpp)

Issue:
File System Shift selecting filtered files selects unfiltered files
### Tested versions

Reproducible in Godot v4.4.beta3

Not reproducible in Godot v4.3.stable

### System information

Godot v4.4.beta3 - Windows 11 (build 22631) - Multi-window, 3 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (NVIDIA; 32.0.15.6614) - AMD Ryzen 5 3600 6-Core Processor (12 threads)

### Issue description

When filtering the search in the file system, if you shift select all the files you want to select, it selects ones you didn't filter for as well. Ctrl clicking them does not have this issue. You can see on 0:06 that there are 11 more files selected.

### Steps to reproduce

https://github.com/user-attachments/assets/50f49980-d9b1-4404-815b-40c74cd9676c

### Minimal reproduction project (MRP)

n/a


Discussion / hints:
Can confirm, regression between dev4 and dev5, bisecting
Bisected to:
* #95107

CC @KoBeWi 

Fix patch:
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 1cc374573127..057b8f3972d9 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -2053,7 +2053,7 @@ Vector<String> FileSystemDock::_tree_get_selected(bool remove_self_inclusion, bo
 	TreeItem *selected = tree->get_root();
 	selected = tree->get_next_selected(selected);
 	while (selected) {
-		if (selected != cursor_item && selected != favorites_item) {
+		if (selected != cursor_item && selected != favorites_item && selected->is_visible_in_tree()) {
 			selected_strings.push_back(selected->get_metadata(0));
 		}
 		selected = tree->get_next_selected(selected);


Test patch: