Browse Source

fix: update new line detection to handle both LF and CRLF

Akeit0 7 months ago
parent
commit
f6abe5289e
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/Lua/Internal/LuaDebug.cs

+ 1 - 1
src/Lua/Internal/LuaDebug.cs

@@ -596,7 +596,7 @@ internal readonly struct LuaDebug : IDisposable
 
 
             PRE.AsSpan().CopyTo(dest);
-            int newLine = source.IndexOf('\n');
+            int newLine = source.IndexOfAny("\r\n");
             if (newLine == -1 && source.Length < BUFFER_LEN - (PRE_LEN + RETS_LEN + POS_LEN))
             {
                 source.CopyTo(dest[PRE_LEN..]);