summaryrefslogtreecommitdiffstats
path: root/scene/gui/file_dialog.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-03-05 09:55:36 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-03-05 09:55:36 +0100
commit9e13b90ce86a0942415e6ecaa6db9d058a673472 (patch)
tree99562af9f5acf3cac79be15ed9043bfcac59cf2b /scene/gui/file_dialog.cpp
parent897e2d9a40713afdd0d0f25a10aa7f6229f6421a (diff)
parent4f8d7cae2601343d6221ec95485fc6812c9a22d8 (diff)
downloadredot-engine-9e13b90ce86a0942415e6ecaa6db9d058a673472.tar.gz
Merge pull request #81177 from Calinou/filedialog-focus-path-shortcut
Add Ctrl + L / Cmd + Shift + G shortcut to focus path bar in FileDialog
Diffstat (limited to 'scene/gui/file_dialog.cpp')
-rw-r--r--scene/gui/file_dialog.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index abed3cf594..a53dffd0d2 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -263,6 +263,27 @@ void FileDialog::shortcut_input(const Ref<InputEvent> &p_event) {
case Key::BACKSPACE: {
_dir_submitted("..");
} break;
+#ifdef MACOS_ENABLED
+ // Cmd + Shift + G (matches Finder's "Go To" shortcut).
+ case Key::G: {
+ if (k->is_command_or_control_pressed() && k->is_shift_pressed()) {
+ dir->grab_focus();
+ dir->select_all();
+ } else {
+ handled = false;
+ }
+ } break;
+#endif
+ // Ctrl + L (matches most Windows/Linux file managers' "focus on path bar" shortcut,
+ // plus macOS Safari's "focus on address bar" shortcut).
+ case Key::L: {
+ if (k->is_command_or_control_pressed()) {
+ dir->grab_focus();
+ dir->select_all();
+ } else {
+ handled = false;
+ }
+ } break;
default: {
handled = false;
}