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

Enter key causes TextEdit to add a space instead of going to the new line #1318

Closed
cppdev123 opened this issue Jun 4, 2022 · 3 comments · Fixed by #1608
Closed

Enter key causes TextEdit to add a space instead of going to the new line #1318

cppdev123 opened this issue Jun 4, 2022 · 3 comments · Fixed by #1608
Labels
a:backend-winit Winit backend (mS,mO) bug Something isn't working

Comments

@cppdev123
Copy link
Contributor

When using TextEdit and pressing enter a space is added then when you try to write the text goes to the new line. Instead a new line should be added when pressing Enter

@ogoffart ogoffart added bug Something isn't working a:platform-wasm browser integration (mO,bT) labels Jun 5, 2022
@ogoffart
Copy link
Member

ogoffart commented Jun 5, 2022

Thanks for the bug report!
I can reproduce the problem in the gallery on wasm in the browser (firefox). But it works fine on the native linux with both backend.

(So this is most likely a bug in wasm_input_helper.rs)

@ogoffart ogoffart added a:backend-winit Winit backend (mS,mO) and removed a:platform-wasm browser integration (mO,bT) labels Jun 5, 2022
@ogoffart
Copy link
Member

ogoffart commented Jun 5, 2022

Actually no, i can also reproduce on desktop with the GL backend. So this is not a wasm problem.
The problem only happens if we are at the last position of the TextEdit. The Qt backend seems to work.

@ogoffart
Copy link
Member

I think this is related to the position of the cursor.
We have some special logic when the cursor is at the end of the text:

&& (range.contains(&cursor_pos)
|| (cursor_pos == range.end && cursor_pos == text.len()))

But that kind of fails if the last character is a \n
Because the \n is at the end of the line, and there is no more line after that (the empty line is not rendered) then we can't know the position of the cursor in the next line in that loop. We would need to special case it.

Another problem is that the selection is drawn over the whitespace at the end of the lines, which the Qt backend doesn't do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:backend-winit Winit backend (mS,mO) bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants