Fix \r\n-style line endings not being properly handled for script errors

This commit is contained in:
abcdefg30
2023-05-20 13:18:18 +02:00
committed by Matthias Mailänder
parent bc5e7d1497
commit 49c837e7d0

View File

@@ -26,7 +26,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var luaScript = world.WorldActor.TraitOrDefault<LuaScript>();
if (luaScript != null)
{
var text = WidgetUtils.WrapText(luaScript.Context.ErrorMessage, label.Bounds.Width, font);
// Native exceptions have OS-dependend line endings, so strip these away as WrapText doesn't handle them
var errorMessage = luaScript.Context.ErrorMessage.Replace("\r\n", "\n");
var text = WidgetUtils.WrapText(errorMessage, label.Bounds.Width, font);
label.Text = text;
label.Bounds.Height = font.Measure(text).Y;
panel.ScrollToTop();