diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-05-20 11:45:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-20 11:45:59 +0200 |
commit | aec07538f47211a8fe87dbc4e42918478da03b1d (patch) | |
tree | ab8be41abc4a96d2b834e85ca5d8964dae939c16 /scene | |
parent | a325a777a647738c222bb70aa1467e4e6516224c (diff) | |
parent | cc473b948f814a52b383590791b5226d15a8b010 (diff) |
Merge pull request #38309 from SkyLucilfer/AndroidLineEdit
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; |