-
Notifications
You must be signed in to change notification settings - Fork 330
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
Backspace misbehavior in wrapped textarea #313
Comments
Thanks for the well written report, I am able to replicate this on my end. I found that this also occurs if we select some text on a soft-wrapped line and then move the caret left or right. I will look into it. |
I was previously under the impression that the delete key didn't cause the caret to move left after a wrapped line, but it in fact does. |
… fix issues related to the cursor being off-by-n with word wrapping enabled. See #313.
Text editing is quite tricky it turns out. But I've made an effort to fix this. I had to refactor a bit, trying to simplify things, because it was very hard to follow the old code with a lot of duplicate state. I may have accidently introduced new bugs with these changes, because text editing is tricky. Could you test the changes I made in the |
It has fixed the issue, and I haven't found any new problems with the patch so far (or old problems, for that matter.) |
- Simplify and remove duplicate cursor state. - The widget's text synchronizes with the element's value attribute. - A sanitization step removes invalid characters for the given text field type. - A separate transformation can be applied which is purely visual, mainly for password fields. This fixes issues such as: - Cursor being off-by-n with word wrapping enabled (see #313). - Windows endlines (\r\n) being displayed with an extra space. - Putting invalid characters (e.g. \t) in a text input's value attribute would make the cursor and text editing apply to a wrong location in the text. - Data bindings are now updated to reflect the sanitized value.
I've been working more on the text widget. I discovered some issues introduced with the previous changes, mainly to do with password fields. In any case, I've made a lot of improvements since then, both quality-of-life improvements, fixing small issues, and code cleanup. See the commit messages for details: https://github.com/mikke89/RmlUi/commits/textarea. I'm re-opening this for some time so that people can be aware of these changes and report any related issues or other feedback. |
I added some additional fixes and changes some commits back. I haven't seen any new issues in a while so I'm closing this one for now. Please open a new issue if you do find any related ones. |
When a textarea contains wrapped text, backspace causes the caret to move to the left, as if the left arrow key was pressed immediately after pressing backspace. Every prior wrapped line causes the caret to move left an additional extra character.
Example text (text is one single line; each string of characters is separated by a space to allow wrapping;
|
represents the caret)After pressing backspace:
(redundant text omitted for brevity)
The text was updated successfully, but these errors were encountered: