jrossignol / ContractConfigurator

A config file based solution for creating new contracts for Kerbal Space Program.
https://forum.kerbalspaceprogram.com/index.php?/topic/91625-1
Other
64 stars 67 forks source link

Config node elements with escaped newlines ('\n') don't behave properly #654

Closed jrossignol closed 6 years ago

jrossignol commented 6 years ago

Brought up by @inigmatus on the forum:

Was testing completedMessage and noticed that \n\n no longer makes a carriage return. Can you confirm?

completedMessage = Another historic flight completed!\n\nYour pilot is starting to showing some amazing skill with that last landing.

turns into:

Another historic flight completed!Your pilot is starting to showing some amazing skill with that last landing.

instead of:

Another historic flight completed!

Your pilot is starting to showing some amazing skill with that last landing.

Turns out the issue is much more of a pain than I thought, as it's rooted in the fact that the Localizer (Lingoona, specifically) are "helping" by unescaping the '\n'. Even if I could workaround the issue, it causes a problem in Module Manager caching (https://github.com/sarbian/ModuleManager/issues/84), so there's no point fixing it if it's not also fixed in MM. Best option is to hope for a KSP fix on #16315, which I've already bugged @JPLRepo about.

If that turns out not to be an option, will need to stop using '\n' and change to &br; as the escape string. Impacts to lots of contracts in the wild.

jrossignol commented 6 years ago

Now I remember KSP Modding... @inigmatus always finds the bugs that end up being hard to fix. ;)

theonegalen commented 6 years ago

Is &br working for line break in the current version of CC? Is it possible to use it to future-proof contracts?

jrossignol commented 6 years ago

No, &br; doesn't currently work. I may add it without changing anything on the \n stuff anyway.

On Sun, Mar 25, 2018, 10:09 PM theonegalen, notifications@github.com wrote:

Is &br working for line break in the current version of CC? Is it possible to use it to future-proof contracts?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrossignol/ContractConfigurator/issues/654#issuecomment-376041060, or mute the thread https://github.com/notifications/unsubscribe-auth/AIUFdWVVrk_Pxlr7urJdZEXTJr9GvihZks5tiGnpgaJpZM4S6S67 .

inigmatus commented 6 years ago

no worries. not hyper critical. a workaround would be neat tho.

jrossignol commented 6 years ago

Given that 1.4.2 dropped today and I have no idea if there's a planned 1.4.3 I'll go ahead with the change to use &br;

jrossignol commented 6 years ago

Hmm... change could have a bigger impact that I initially thought (minor save breakage). Need to think on this one a bit yet.

jrossignol commented 6 years ago

Alright, so here's the current state with 16113bd1c1df0b9ba21a641e40b596d31a168b12. I now have it parsing both \n and &br; within config nodes anywhere. The default for the stuff in the save file is &br; internally, which works around the stock issue. The old newline (\n) is still available and will be the publicly documented way (but feel free to switch to &br;). Right now, newlines will have some problems with Module Manager, due to the stock bug.

This way things should "just work" when we get a stock fix, and I don't have to go and break a bunch of existing contract packs that aren't maintained. If you choose to use &br;, that's fine as that will always be supported moving forward.

inigmatus commented 6 years ago

confirmed fixed.