-
-
Notifications
You must be signed in to change notification settings - Fork 843
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
Multiline TextField + TextEvent.TEXT_INPUT: event.text should be \n instead of \r when user press enter #19482
Comments
Did we hardcode this wrong? ruffle/core/src/display_object/edit_text.rs Line 249 in a4eecae
The following test code produces U+A (Line Feed) for me on Linux with Flash: package {
import flash.display.Sprite;
import flash.events.TextEvent;
import flash.text.TextField;
import flash.text.TextFieldType;
public class Test extends Sprite {
public function Test() {
var textField = new TextField();
textField.type = TextFieldType.INPUT;
textField.border = true;
textField.multiline = true;
textField.height = 200;
textField.addEventListener(TextEvent.TEXT_INPUT, onInput);
addChild(textField);
}
public function onInput(evt: TextEvent) {
trace("onInput: U+" + evt.text.charCodeAt(0).toString(16).toUpperCase() + " " + evt.text.length);
}
}
} |
I believe Flash is just weird with newlines. We should write some tests related to newlines in every possible place that a newline might allear. I believe Flash uses internally CR for newlines, but sometimes surfaces it as LF to the user. |
Ah, I think I know what you mean. Entering [A] [Enter] [B] produces the |
I think we should also replace LF with CR when setting the text (e.g. |
At least for the KEY_DOWN event Flash also uses a CR. (#19518) |
I remember that years ago I had read somewhere that Flash expect the newline that user So in this case the There's no problem if user |
Describe the bug
On TextEvent.TEXT_INPUT event handler, when I get
event.text
:Flash: I got
event.text
=\n
Ruffle: I got
event.text
=\r
Expected behavior
event.text
should return\n
Content Location
There's no need a swf to reproduce the bug.
Affected platform
Desktop app
Operating system
Windows 11
Browser
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: