From 49c837e7d08861f5c4138cf36cf6e1fa31963929 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sat, 20 May 2023 13:18:18 +0200 Subject: [PATCH] Fix \r\n-style line endings not being properly handled for script errors --- OpenRA.Mods.Common/Widgets/Logic/Ingame/ScriptErrorLogic.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ScriptErrorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ScriptErrorLogic.cs index c49ba780c6..2f0d00b962 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ScriptErrorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ScriptErrorLogic.cs @@ -26,7 +26,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic var luaScript = world.WorldActor.TraitOrDefault(); 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();