Browse Source

Remove auto selecting the first file for FileDialog with Save file mode selected

(cherry picked from commit 5cd30be56d1d34d84bd423fb99f8fa03edbfe75e)
Dawid Marzec 2 years ago
parent
commit
1a123070c8
1 changed files with 5 additions and 2 deletions
  1. 5 2
      scene/gui/file_dialog.cpp

+ 5 - 2
scene/gui/file_dialog.cpp

@@ -529,8 +529,11 @@ void FileDialog::update_file_list() {
 		files.pop_front();
 	}
 
-	if (tree->get_root() && tree->get_root()->get_children() && tree->get_selected() == nullptr) {
-		tree->get_root()->get_children()->select(0);
+	if (mode != MODE_SAVE_FILE) {
+		// Select the first file from list if nothing is selected.
+		if (tree->get_root() && tree->get_root()->get_children() && tree->get_selected() == nullptr) {
+			tree->get_root()->get_children()->select(0);
+		}
 	}
 }