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

[3.2] [iOS] Keyboard input changes #43560

Merged
merged 3 commits into from
Dec 16, 2020
Merged

Conversation

naithar
Copy link
Contributor

@naithar naithar commented Nov 15, 2020

Added a cursor_start and cursor_end parameters for TextEdit control.
Changed a way iOS's keyboard is handled by moving handing into separate class. Now it can display suggestions view for languages that require it. This change also allows to receive text changes made by dictation or any other text input method.

Fixes #43256 for 3.2 branch

@naithar
Copy link
Contributor Author

naithar commented Nov 15, 2020

Since this PR changes how TextEdit's virtual keyboard work, I think it should also be tested on Android by someone if it's possible.

@pouleyKetchoupp
Copy link
Contributor

pouleyKetchoupp commented Dec 16, 2020

I've finally tested on Android and spotted an issue. It doesn't seem to be platform specific.

Repro steps are:
1.Launch android-ui.zip
2.Select the TextEdit control
3.Type abcd
4.Select the LineEdit control
5.Select the TextEdit control again (after abcd)
6.Press backspace on the virtual keyboard
7.Observe backspace is not working

There's an error in the log when the virtual keyboard is triggered:

ERROR: TextEdit::_base_get_text: Index p_to_column = 5 is out of bounds (text[p_to_line].length() + 1 = 5).
   At: scene\gui\text_edit.cpp:4018

On this line in the new code:

String text = _base_get_text(0, 0, selection.selecting_line, selection.selecting_column);

I can confirm selection.selecting_column is 5 and not 4 in this scenario by debugging step by step on Windows (and forcing the virtual keyboard path).

Can you reproduce this issue on iOS?

I haven't tested on master, so I'm not sure if the 4.0 version of this PR has the same problem.
Edit: I can reproduce it on master, I've open an issue: #44416

@naithar naithar force-pushed the fix/ios-keyboard branch 2 times, most recently from c9dc48b to 02ff98d Compare December 16, 2020 02:06
@naithar
Copy link
Contributor Author

naithar commented Dec 16, 2020

@pouleyKetchoupp thanks!
I've managed to reproduce this issue on your MRP, but my test project wasn't reproducing this bug.
Latest commit should fix this issue, but I'll run more tests just to be sure.

@naithar
Copy link
Contributor Author

naithar commented Dec 16, 2020

Found some strange bug. My old test project gives me incorrect text input and duplicates the text.
I'll investigate more.

@pouleyKetchoupp
Copy link
Contributor

To fix the bug you mentioned I think this line:

String full_text = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length());

Can be replaced with:

String full_text = _base_get_text(0, 0, cursor.line, cursor.column);

Apart from that it seems to work fine now!

@naithar
Copy link
Contributor Author

naithar commented Dec 16, 2020

To fix the bug you mentioned I think this line:

String full_text = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length());

Can be replaced with:

String full_text = _base_get_text(0, 0, cursor.line, cursor.column);

Apart from that it seems to work fine now!

Yup, I'm waiting for a build to test it right now :)

Edit:

Seems to be fixed now with latest commit.

@pouleyKetchoupp
Copy link
Contributor

On Android, this PR also fixes the same issues #38309 did for LineEdit on TextEdit.

@akien-mga akien-mga merged commit 574ca8a into godotengine:3.2 Dec 16, 2020
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants