Improve null check in FindReplaceBar
This commit is contained in:
parent
b43fb407b1
commit
e94b8a6acc
@ -108,8 +108,12 @@ 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()) {
|
||||||
if (k->is_pressed() && (text_edit->has_focus() || vbc_lineedit->is_a_parent_of(get_focus_owner()))) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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_keycode()) {
|
switch (k->get_keycode()) {
|
||||||
@ -126,7 +130,6 @@ void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_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) {
|
||||||
int line, col;
|
int line, col;
|
||||||
|
Loading…
Reference in New Issue
Block a user