diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/code_edit.cpp | 2 | ||||
-rw-r--r-- | scene/gui/popup.cpp | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index b084cb5bea..e2f7ec860c 100644 --- a/scene/gui/code_edit.cpp +++ b/scene/gui/code_edit.cpp @@ -2856,7 +2856,7 @@ void CodeEdit::_filter_code_completion_candidates_impl() { const int caret_line = get_caret_line(); const int caret_column = get_caret_column(); const String line = get_line(caret_line); - ERR_FAIL_INDEX_MSG(caret_column - 1, line.length(), "Caret column exceeds line length."); + ERR_FAIL_INDEX_MSG(caret_column, line.length() + 1, "Caret column exceeds line length."); if (caret_column > 0 && line[caret_column - 1] == '(' && !code_completion_forced) { cancel_code_completion(); diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 2ea1b93810..432004dedc 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -36,7 +36,7 @@ void Popup::_input_from_window(const Ref<InputEvent> &p_event) { Ref<InputEventKey> key = p_event; - if (key.is_valid() && key->is_pressed() && key->get_keycode() == Key::ESCAPE) { + if (get_flag(FLAG_POPUP) && key.is_valid() && key->is_pressed() && key->get_keycode() == Key::ESCAPE) { _close_pressed(); } } @@ -102,12 +102,17 @@ void Popup::_notification(int p_what) { } } break; - case NOTIFICATION_WM_CLOSE_REQUEST: - case NOTIFICATION_APPLICATION_FOCUS_OUT: { + case NOTIFICATION_WM_CLOSE_REQUEST: { if (!is_in_edited_scene_root()) { _close_pressed(); } } break; + + case NOTIFICATION_APPLICATION_FOCUS_OUT: { + if (!is_in_edited_scene_root() && get_flag(FLAG_POPUP)) { + _close_pressed(); + } + } break; } } |