aboutsummaryrefslogtreecommitdiff
path: root/editor/editor_help.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2018-05-25 17:49:36 +0200
committerGitHub2018-05-25 17:49:36 +0200
commitba125a60a40955da04a9c0d079c906cc0fc06fd0 (patch)
treeadce5497751bf3f0bee05e55fb7714fcdfcdf33a /editor/editor_help.cpp
parent335679f48198364ab0d0c2f21c0a86fecdd726e0 (diff)
parent22041264ed38b65379a46a54050448d3807b5936 (diff)
downloadgodot-ba125a60a40955da04a9c0d079c906cc0fc06fd0.tar.gz
godot-ba125a60a40955da04a9c0d079c906cc0fc06fd0.tar.zst
godot-ba125a60a40955da04a9c0d079c906cc0fc06fd0.zip
Merge pull request #18931 from guilhermefelipecgs/fix_find_bar
[Doc] Fixes in find bar
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r--editor/editor_help.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index f9b104cda..b49c2d26d 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1978,8 +1978,27 @@ FindBar::FindBar() {
}
void FindBar::popup_search() {
+
show();
- search_text->grab_focus();
+ bool grabbed_focus = false;
+ if (!search_text->has_focus()) {
+ search_text->grab_focus();
+ grabbed_focus = true;
+ }
+
+ if (!search_text->get_text().empty()) {
+ search_text->select_all();
+ search_text->set_cursor_position(search_text->get_text().length());
+ if (grabbed_focus) {
+ _search();
+ }
+ }
+
+ call_deferred("_update_size");
+}
+
+void FindBar::_update_size() {
+
container->set_custom_minimum_size(Size2(0, hbc->get_size().height));
}
@@ -2016,6 +2035,7 @@ void FindBar::_bind_methods() {
ClassDB::bind_method("_search_next", &FindBar::search_next);
ClassDB::bind_method("_search_prev", &FindBar::search_prev);
ClassDB::bind_method("_hide_pressed", &FindBar::_hide_bar);
+ ClassDB::bind_method("_update_size", &FindBar::_update_size);
ADD_SIGNAL(MethodInfo("search"));
}