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
Fix serialization of control expressions with line breaks #9703
Fix serialization of control expressions with line breaks #9703
Conversation
c838ce6
to
b47a662
Compare
|
Why not just do the classic string escaping and escape |
If the user writes |
|
I know very little about this code but I'm also confused. I don't see why we can't just serialize the exact string the user provides and deserialize the exact string the user provides. Then it just becomes a parsing problem (no different whether they load from save or type something in). |
You can't serialize actual line breaks in a dolphin config. Every config is just one line. Or so it seems. |
The control expression editor allows line breaks, but the serialization was losing anything after the first line break (/r /n). Instead of opting to encode them and decode them on serialization (which I tried but was not safe, as it would lose /n written in the string by users), I opted to replace them with a space.
b47a662
to
5744778
Compare
|
Implementing typical backslash escaping will break current configs with device names containing a backslash unless the escaping is implemented at the expression parser level. The real problem is our ini-file code being bad. It shouldn't be the job of input code to escape newlines so the config can be saved. |
The control expression editor allows line breaks, but the serialization was losing anything after the first line break (/r /n).
Instead of opting to encode them and decode them on serialization,
which I tried but was not safe, as it would lose
\nwritten in the expression by users,I opted to replace them with a space, to at least maintain some of the spacing the user originally put in.
Completely removing them could also have caused the expression to be parsed differently.
This cannot cause any breaking differences on the expression, and its in any way better than before, as before part of the string could just get lost.