|
@@ -3152,8 +3152,12 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
|
|
|
}
|
|
|
|
|
|
void Tree::_text_editor_popup_modal_close() {
|
|
|
+ if (popup_edit_commited) {
|
|
|
+ return; // Already processed by LineEdit/TextEdit commit.
|
|
|
+ }
|
|
|
+
|
|
|
if (popup_editor->get_hide_reason() == Popup::HIDE_REASON_CANCELED) {
|
|
|
- return;
|
|
|
+ return; // ESC pressed, app focus lost, or forced close from code.
|
|
|
}
|
|
|
|
|
|
if (value_editor->has_point(value_editor->get_local_mouse_position())) {
|
|
@@ -3172,9 +3176,18 @@ void Tree::_text_editor_popup_modal_close() {
|
|
|
}
|
|
|
|
|
|
void Tree::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
|
|
|
+ if (popup_edit_commited) {
|
|
|
+ return; // Already processed by _text_editor_popup_modal_close
|
|
|
+ }
|
|
|
+
|
|
|
+ if (popup_editor->get_hide_reason() == Popup::HIDE_REASON_CANCELED) {
|
|
|
+ return; // ESC pressed, app focus lost, or forced close from code.
|
|
|
+ }
|
|
|
+
|
|
|
if (p_event->is_action_pressed("ui_text_newline_blank", true)) {
|
|
|
accept_event();
|
|
|
} else if (p_event->is_action_pressed("ui_text_newline")) {
|
|
|
+ popup_edit_commited = true; // End edit popup processing.
|
|
|
popup_editor->hide();
|
|
|
_apply_multiline_edit();
|
|
|
accept_event();
|
|
@@ -3205,6 +3218,15 @@ void Tree::_apply_multiline_edit() {
|
|
|
}
|
|
|
|
|
|
void Tree::_line_editor_submit(String p_text) {
|
|
|
+ if (popup_edit_commited) {
|
|
|
+ return; // Already processed by _text_editor_popup_modal_close
|
|
|
+ }
|
|
|
+
|
|
|
+ if (popup_editor->get_hide_reason() == Popup::HIDE_REASON_CANCELED) {
|
|
|
+ return; // ESC pressed, app focus lost, or forced close from code.
|
|
|
+ }
|
|
|
+
|
|
|
+ popup_edit_commited = true; // End edit popup processing.
|
|
|
popup_editor->hide();
|
|
|
|
|
|
if (!popup_edited_item) {
|
|
@@ -4072,6 +4094,7 @@ bool Tree::edit_selected(bool p_force_edit) {
|
|
|
if (!popup_editor->is_embedded()) {
|
|
|
popup_editor->set_content_scale_factor(popup_scale);
|
|
|
}
|
|
|
+ popup_edit_commited = false; // Start edit popup processing.
|
|
|
popup_editor->popup();
|
|
|
popup_editor->child_controls_changed();
|
|
|
|
|
@@ -4091,6 +4114,7 @@ bool Tree::edit_selected(bool p_force_edit) {
|
|
|
if (!popup_editor->is_embedded()) {
|
|
|
popup_editor->set_content_scale_factor(popup_scale);
|
|
|
}
|
|
|
+ popup_edit_commited = false; // Start edit popup processing.
|
|
|
popup_editor->popup();
|
|
|
popup_editor->child_controls_changed();
|
|
|
|