make terminal write synchronous
This commit is contained in:
@@ -37,7 +37,7 @@ public partial class DebugPanelTab : Control
|
||||
{
|
||||
await foreach (var array in Project.RunningOutputChannel!.Reader.ReadAllAsync().ConfigureAwait(false))
|
||||
{
|
||||
await _terminal.WriteAsync(array);
|
||||
_terminal.Write(array);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public partial class RunPanelTab : Control
|
||||
{
|
||||
await foreach (var array in Project.RunningOutputChannel!.Reader.ReadAllAsync().ConfigureAwait(false))
|
||||
{
|
||||
await _terminal.WriteAsync(array);
|
||||
_terminal.Write(array);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,19 +12,18 @@ public partial class SharpIdeTerminal : Control
|
||||
var terminalControl = GetNode<Control>("Terminal");
|
||||
_terminal = new Terminal(terminalControl);
|
||||
}
|
||||
|
||||
[RequiresGodotUiThread]
|
||||
|
||||
public void Write(string text)
|
||||
{
|
||||
_terminal.Write(text);
|
||||
}
|
||||
|
||||
public async Task WriteAsync(byte[] text)
|
||||
public void Write(byte[] text)
|
||||
{
|
||||
var (processedArray, length, wasRented) = ProcessLineEndings(text);
|
||||
try
|
||||
{
|
||||
await this.InvokeAsync(() => _terminal.Write(processedArray.AsSpan(0, length)));
|
||||
_terminal.Write(processedArray.AsSpan(0, length));
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -36,7 +35,6 @@ public partial class SharpIdeTerminal : Control
|
||||
_previousArrayEndedInCr = text.Length > 0 && text[^1] == (byte)'\r';
|
||||
}
|
||||
|
||||
[RequiresGodotUiThread]
|
||||
public void ClearTerminal()
|
||||
{
|
||||
// .Clear removes all text except for the bottom row, so lets make sure we have a blank line, and cursor at start
|
||||
|
||||
Reference in New Issue
Block a user