From 03ae12b069f20a94902342e1770a7f0cab9c8031 Mon Sep 17 00:00:00 2001 From: Dawid Marzec Date: Sun, 13 Nov 2022 02:24:17 +0100 Subject: [PATCH] Remove auto selecting the first file for FileDialog with Save file mode selected (cherry picked from commit 5cd30be56d1d34d84bd423fb99f8fa03edbfe75e) --- scene/gui/file_dialog.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 45d1f2695..f762709b0 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -541,8 +541,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); + } } }