summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorSkyJJ <jjchai01@hotmail.com>2020-04-28 19:57:45 +0200
committerSkyJJ <jjchai01@hotmail.com>2020-05-16 17:55:27 +0200
commitcc473b948f814a52b383590791b5226d15a8b010 (patch)
treefc9be3384ef416c0672c86730240f0b26fbe07e3 /scene
parent2fa795dea9b5ef672dd8ba75c26140e194d3f207 (diff)
Fix Android LineEdit editing bugs
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/line_edit.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index e3c75491f7..fbacb3ed9e 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -119,7 +119,11 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
selection.doubleclick = false;
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_VIRTUAL_KEYBOARD)) {
- DisplayServer::get_singleton()->virtual_keyboard_show(text, get_global_rect(), max_length);
+ if (selection.enabled) {
+ DisplayServer::get_singleton()->virtual_keyboard_show(text, get_global_rect(), max_length, selection.begin, selection.end);
+ } else {
+ DisplayServer::get_singleton()->virtual_keyboard_show(text, get_global_rect(), max_length, cursor_pos);
+ }
}
}
@@ -918,7 +922,11 @@ void LineEdit::_notification(int p_what) {
}
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_VIRTUAL_KEYBOARD)) {
- DisplayServer::get_singleton()->virtual_keyboard_show(text, get_global_rect(), max_length);
+ if (selection.enabled) {
+ DisplayServer::get_singleton()->virtual_keyboard_show(text, get_global_rect(), max_length, selection.begin, selection.end);
+ } else {
+ DisplayServer::get_singleton()->virtual_keyboard_show(text, get_global_rect(), max_length, cursor_pos);
+ }
}
} break;