Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix removing last digit in spinbox while update_on_text_changed is true #99721

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions scene/gui/spin_box.cpp
Original file line number Diff line number Diff line change
@@ -68,6 +68,10 @@ void SpinBox::_update_text(bool p_keep_line_edit) {
}

void SpinBox::_text_submitted(const String &p_string) {
if (p_string.is_empty()) {
return;
}

Ref<Expression> expr;
expr.instantiate();

@@ -284,8 +288,8 @@ void SpinBox::_line_edit_editing_toggled(bool p_toggled_on) {
line_edit->select_all();
}
} else {
// Discontinue because the focus_exit was caused by canceling.
if (Input::get_singleton()->is_action_pressed("ui_cancel")) {
// Discontinue because the focus_exit was caused by canceling or the text is empty.
if (Input::get_singleton()->is_action_pressed("ui_cancel") || line_edit->get_text().is_empty()) {
_update_text();
return;
}