Merge pull request #32686 from MarqusJonsson/master

Add shortcut Shift + F3 to search pervious in the built-in docs
This commit is contained in:
Rémi Verschelde 2019-10-10 11:14:18 +02:00 committed by GitHub
commit f0f972076a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 6 deletions

View file

@ -72,8 +72,11 @@ void EditorHelp::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
} }
} }
void EditorHelp::_search(const String &) { void EditorHelp::_search(bool p_search_previous) {
if (p_search_previous)
find_bar->search_prev();
else
find_bar->search_next(); find_bar->search_next();
} }
@ -1502,8 +1505,8 @@ String EditorHelp::get_class() {
return edited_class; return edited_class;
} }
void EditorHelp::search_again() { void EditorHelp::search_again(bool p_search_previous) {
_search(prev_search); _search(p_search_previous);
} }
int EditorHelp::get_scroll() const { int EditorHelp::get_scroll() const {

View file

@ -158,7 +158,7 @@ class EditorHelp : public VBoxContainer {
void _update_doc(); void _update_doc();
void _request_help(const String &p_string); void _request_help(const String &p_string);
void _search(const String &p_str); void _search(bool p_search_previous = false);
void _unhandled_key_input(const Ref<InputEvent> &p_ev); void _unhandled_key_input(const Ref<InputEvent> &p_ev);
@ -179,7 +179,7 @@ public:
void scroll_to_section(int p_section_index); void scroll_to_section(int p_section_index);
void popup_search(); void popup_search();
void search_again(); void search_again(bool p_search_previous = false);
String get_class(); String get_class();

View file

@ -1325,6 +1325,9 @@ void ScriptEditor::_menu_option(int p_option) {
case HELP_SEARCH_FIND_NEXT: { case HELP_SEARCH_FIND_NEXT: {
help->search_again(); help->search_again();
} break; } break;
case HELP_SEARCH_FIND_PREVIOUS: {
help->search_again(true);
} break;
case FILE_CLOSE: { case FILE_CLOSE: {
_close_current_tab(); _close_current_tab();
} break; } break;
@ -2827,6 +2830,7 @@ void ScriptEditor::_update_selected_editor_menu() {
script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F), HELP_SEARCH_FIND); script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F), HELP_SEARCH_FIND);
script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), HELP_SEARCH_FIND_NEXT); script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), HELP_SEARCH_FIND_NEXT);
script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_previous", TTR("Find Previous"), KEY_MASK_SHIFT | KEY_F3), HELP_SEARCH_FIND_PREVIOUS);
script_search_menu->get_popup()->add_separator(); script_search_menu->get_popup()->add_separator();
script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F), SEARCH_IN_FILES); script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F), SEARCH_IN_FILES);
script_search_menu->show(); script_search_menu->show();

View file

@ -168,6 +168,7 @@ class ScriptEditor : public PanelContainer {
REQUEST_DOCS, REQUEST_DOCS,
HELP_SEARCH_FIND, HELP_SEARCH_FIND,
HELP_SEARCH_FIND_NEXT, HELP_SEARCH_FIND_NEXT,
HELP_SEARCH_FIND_PREVIOUS,
WINDOW_MOVE_UP, WINDOW_MOVE_UP,
WINDOW_MOVE_DOWN, WINDOW_MOVE_DOWN,
WINDOW_NEXT, WINDOW_NEXT,