diff options
author | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2018-11-26 13:38:39 -0200 |
---|---|---|
committer | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2018-11-26 13:40:59 -0200 |
commit | 78b9b7c42b8cb61a5dc303ef9803b2e2973ccc4f (patch) | |
tree | 2baa786a3f693299fdb621ac8ff5aecabf4f880d | |
parent | 942855a9ee376ce6ee30a25674856ba64316b548 (diff) |
Restore previous scroll position when reopening the search help dialog with a old search
-rw-r--r-- | editor/editor_help_search.cpp | 13 | ||||
-rw-r--r-- | editor/editor_help_search.h | 1 |
2 files changed, 12 insertions, 2 deletions
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index ace747e5c6..8676dac921 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -140,7 +140,15 @@ void EditorHelpSearch::_notification(int p_what) { if (search.is_valid()) { if (search->work()) { // Search done. + + // Only point to the perfect match if it's a new search, and not just reopening a old one. + if (!old_search) + results_tree->ensure_cursor_is_visible(); + else + old_search = false; + get_ok()->set_disabled(!results_tree->get_selected()); + search = Ref<Runner>(); set_process(false); } @@ -177,6 +185,7 @@ void EditorHelpSearch::popup_dialog(const String &p_term) { if (p_term == "") { search_box->clear(); } else { + old_search = true; search_box->set_text(p_term); search_box->select_all(); } @@ -186,6 +195,8 @@ void EditorHelpSearch::popup_dialog(const String &p_term) { EditorHelpSearch::EditorHelpSearch() { + old_search = false; + set_hide_on_ok(false); set_resizable(true); set_title(TTR("Search Help")); @@ -406,8 +417,6 @@ bool EditorHelpSearch::Runner::_phase_select_match() { if (matched_item) matched_item->select(0); - results_tree->ensure_cursor_is_visible(); - return true; } diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h index 544860f282..d71ad5f12d 100644 --- a/editor/editor_help_search.h +++ b/editor/editor_help_search.h @@ -58,6 +58,7 @@ class EditorHelpSearch : public ConfirmationDialog { ToolButton *hierarchy_button; OptionButton *filter_combo; Tree *results_tree; + bool old_search; class Runner; Ref<Runner> search; |