You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-19 14:31:59 +00:00
Merge pull request #49295 from foxydevloper/fix-focus-filter
Fix "Filter Files" shortcut by merging duplicate functions
This commit is contained in:
@@ -1985,20 +1985,6 @@ void FileSystemDock::_resource_created() {
|
|||||||
editor->save_resource_as(RES(r), fpath);
|
editor->save_resource_as(RES(r), fpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSystemDock::_focus_current_search_box() {
|
|
||||||
LineEdit *current_search_box = nullptr;
|
|
||||||
if (display_mode == DISPLAY_MODE_TREE_ONLY) {
|
|
||||||
current_search_box = tree_search_box;
|
|
||||||
} else if (display_mode == DISPLAY_MODE_SPLIT) {
|
|
||||||
current_search_box = file_list_search_box;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current_search_box) {
|
|
||||||
current_search_box->grab_focus();
|
|
||||||
current_search_box->select_all();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileSystemDock::_search_changed(const String &p_text, const Control *p_from) {
|
void FileSystemDock::_search_changed(const String &p_text, const Control *p_from) {
|
||||||
if (searched_string.length() == 0) {
|
if (searched_string.length() == 0) {
|
||||||
// Register the uncollapsed paths before they change.
|
// Register the uncollapsed paths before they change.
|
||||||
@@ -2040,7 +2026,17 @@ void FileSystemDock::fix_dependencies(const String &p_for_file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileSystemDock::focus_on_filter() {
|
void FileSystemDock::focus_on_filter() {
|
||||||
file_list_search_box->grab_focus();
|
LineEdit *current_search_box = nullptr;
|
||||||
|
if (display_mode == DISPLAY_MODE_TREE_ONLY) {
|
||||||
|
current_search_box = tree_search_box;
|
||||||
|
} else if (display_mode == DISPLAY_MODE_SPLIT) {
|
||||||
|
current_search_box = file_list_search_box;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current_search_box) {
|
||||||
|
current_search_box->grab_focus();
|
||||||
|
current_search_box->select_all();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSystemDock::set_file_list_display_mode(FileListDisplayMode p_mode) {
|
void FileSystemDock::set_file_list_display_mode(FileListDisplayMode p_mode) {
|
||||||
@@ -2590,7 +2586,7 @@ void FileSystemDock::_tree_gui_input(Ref<InputEvent> p_event) {
|
|||||||
} else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) {
|
} else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) {
|
||||||
_tree_rmb_option(FILE_RENAME);
|
_tree_rmb_option(FILE_RENAME);
|
||||||
} else if (ED_IS_SHORTCUT("editor/open_search", p_event)) {
|
} else if (ED_IS_SHORTCUT("editor/open_search", p_event)) {
|
||||||
_focus_current_search_box();
|
focus_on_filter();
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2611,7 +2607,7 @@ void FileSystemDock::_file_list_gui_input(Ref<InputEvent> p_event) {
|
|||||||
} else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) {
|
} else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) {
|
||||||
_file_list_rmb_option(FILE_RENAME);
|
_file_list_rmb_option(FILE_RENAME);
|
||||||
} else if (ED_IS_SHORTCUT("editor/open_search", p_event)) {
|
} else if (ED_IS_SHORTCUT("editor/open_search", p_event)) {
|
||||||
_focus_current_search_box();
|
focus_on_filter();
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,7 +253,6 @@ private:
|
|||||||
|
|
||||||
void _toggle_split_mode(bool p_active);
|
void _toggle_split_mode(bool p_active);
|
||||||
|
|
||||||
void _focus_current_search_box();
|
|
||||||
void _search_changed(const String &p_text, const Control *p_from);
|
void _search_changed(const String &p_text, const Control *p_from);
|
||||||
|
|
||||||
MenuButton *_create_file_menu_button();
|
MenuButton *_create_file_menu_button();
|
||||||
|
|||||||
Reference in New Issue
Block a user