diff options
-rw-r--r-- | main/main.cpp | 4 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 1 | ||||
-rw-r--r-- | tests/scene/test_text_edit.h | 44 |
3 files changed, 47 insertions, 2 deletions
diff --git a/main/main.cpp b/main/main.cpp index ae3a6d2a94..5bb37df3ca 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1813,7 +1813,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph window_orientation = DisplayServer::ScreenOrientation(int(GLOBAL_DEF_BASIC("display/window/handheld/orientation", DisplayServer::ScreenOrientation::SCREEN_LANDSCAPE))); } { - window_vsync_mode = DisplayServer::VSyncMode(int(GLOBAL_DEF("display/window/vsync/vsync_mode", DisplayServer::VSyncMode::VSYNC_ENABLED))); + window_vsync_mode = DisplayServer::VSyncMode(int(GLOBAL_DEF_BASIC("display/window/vsync/vsync_mode", DisplayServer::VSyncMode::VSYNC_ENABLED))); if (disable_vsync) { window_vsync_mode = DisplayServer::VSyncMode::VSYNC_DISABLED; } @@ -2194,7 +2194,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { RenderingServer::get_singleton()->set_default_clear_color( GLOBAL_GET("rendering/environment/defaults/default_clear_color")); - GLOBAL_DEF(PropertyInfo(Variant::STRING, "application/config/icon", PROPERTY_HINT_FILE, "*.png,*.webp,*.svg"), String()); + GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/config/icon", PROPERTY_HINT_FILE, "*.png,*.webp,*.svg"), String()); GLOBAL_DEF(PropertyInfo(Variant::STRING, "application/config/macos_native_icon", PROPERTY_HINT_FILE, "*.icns"), String()); GLOBAL_DEF(PropertyInfo(Variant::STRING, "application/config/windows_native_icon", PROPERTY_HINT_FILE, "*.ico"), String()); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 2b3b577697..ebca8296a0 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2681,6 +2681,7 @@ void TextEdit::_do_backspace(bool p_word, bool p_all_to_left) { set_caret_line(get_caret_line(caret_idx), false, true, 0, caret_idx); set_caret_column(column, caret_idx == 0, caret_idx); + adjust_carets_after_edit(caret_idx, get_caret_line(caret_idx), column, get_caret_line(caret_idx), from_column); // Now we can clean up the overlapping caret. if (overlapping_caret_index != -1) { diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h index 64ad3bd5b0..f3f2b4cb34 100644 --- a/tests/scene/test_text_edit.h +++ b/tests/scene/test_text_edit.h @@ -1779,6 +1779,50 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK("lines_edited_from", lines_edited_args); } + SUBCASE("[TextEdit] ui_text_backspace_word same line") { + text_edit->set_text("test test test"); + text_edit->set_caret_column(4); + text_edit->add_caret(0, 9); + text_edit->add_caret(0, 15); + + // For the second caret. + Array args2; + args2.push_back(0); + lines_edited_args.push_front(args2); + + // For the third caret. + Array args3; + args2.push_back(0); + lines_edited_args.push_front(args2); + + CHECK(text_edit->get_caret_count() == 3); + MessageQueue::get_singleton()->flush(); + + SIGNAL_DISCARD("text_set"); + SIGNAL_DISCARD("text_changed"); + SIGNAL_DISCARD("lines_edited_from"); + SIGNAL_DISCARD("caret_changed"); + + SEND_GUI_ACTION("ui_text_backspace_word"); + CHECK(text_edit->get_viewport()->is_input_handled()); + CHECK(text_edit->get_text() == " "); + CHECK(text_edit->get_caret_line() == 0); + CHECK(text_edit->get_caret_column() == 0); + CHECK_FALSE(text_edit->has_selection(0)); + + CHECK(text_edit->get_caret_line(1) == 0); + CHECK(text_edit->get_caret_column(1) == 1); + CHECK_FALSE(text_edit->has_selection(1)); + + CHECK(text_edit->get_caret_line(2) == 0); + CHECK(text_edit->get_caret_column(2) == 2); + CHECK_FALSE(text_edit->has_selection(1)); + + SIGNAL_CHECK("caret_changed", empty_signal_args); + SIGNAL_CHECK("text_changed", empty_signal_args); + SIGNAL_CHECK("lines_edited_from", lines_edited_args); + } + SUBCASE("[TextEdit] ui_text_backspace") { text_edit->set_text("\nthis is some test text.\n\nthis is some test text."); text_edit->select(1, 0, 1, 4); |