Improve null check in FindReplaceBar
(cherry picked from commit e94b8a6acc
)
This commit is contained in:
parent
bd90f236d3
commit
3f57cb12b4
|
@ -116,20 +116,19 @@ void FindReplaceBar::_notification(int p_what) {
|
||||||
void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) {
|
void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
Ref<InputEventKey> k = p_event;
|
Ref<InputEventKey> k = p_event;
|
||||||
if (k.is_valid()) {
|
if (!k.is_valid() || !k->is_pressed()) {
|
||||||
|
return;
|
||||||
if (k->is_pressed() && (text_edit->has_focus() || vbc_lineedit->is_a_parent_of(get_focus_owner()))) {
|
}
|
||||||
|
|
||||||
|
Control *focus_owner = get_focus_owner();
|
||||||
|
if (text_edit->has_focus() || (focus_owner && vbc_lineedit->is_a_parent_of(focus_owner))) {
|
||||||
bool accepted = true;
|
bool accepted = true;
|
||||||
|
|
||||||
switch (k->get_scancode()) {
|
switch (k->get_scancode()) {
|
||||||
|
|
||||||
case KEY_ESCAPE: {
|
case KEY_ESCAPE: {
|
||||||
|
|
||||||
_hide_bar();
|
_hide_bar();
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
|
|
||||||
accepted = false;
|
accepted = false;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
@ -138,7 +137,6 @@ void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) {
|
||||||
accept_event();
|
accept_event();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) {
|
bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) {
|
||||||
|
|
Loading…
Reference in New Issue