diff options
author | SkyJJ <jjchai01@hotmail.com> | 2020-04-28 19:57:45 +0200 |
---|---|---|
committer | SkyJJ <jjchai01@hotmail.com> | 2020-05-16 17:55:27 +0200 |
commit | cc473b948f814a52b383590791b5226d15a8b010 (patch) | |
tree | fc9be3384ef416c0672c86730240f0b26fbe07e3 /scene | |
parent | 2fa795dea9b5ef672dd8ba75c26140e194d3f207 (diff) |
Fix Android LineEdit editing bugs
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/line_edit.cpp | 12 |
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; |