fix missing carriage returns on unix

This commit is contained in:
Matt Parker
2026-01-19 19:09:28 +10:00
parent ddc9286029
commit 67b875e72d
2 changed files with 78 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
using System.Buffers;
using GDExtensionBindgen;
using Godot;
@@ -20,9 +21,21 @@ public partial class SharpIdeTerminal : Control
public async Task WriteAsync(byte[] text)
{
await this.InvokeAsync(() => _terminal.Write(text));
var (processedArray, length, wasRented) = ProcessLineEndings(text);
try
{
await this.InvokeAsync(() => _terminal.Write(processedArray.AsSpan(0, length)));
}
finally
{
if (wasRented)
{
ArrayPool<byte>.Shared.Return(processedArray);
}
}
_previousArrayEndedInCr = text.Length > 0 && text[^1] == (byte)'\r';
}
[RequiresGodotUiThread]
public void ClearTerminal()
{