From 3ada44e439ce23c526216bc6024893dcbc23d94a Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:29:01 +1000 Subject: [PATCH] make terminal write synchronous --- src/SharpIDE.Godot/Features/Debug_/Tab/DebugPanelTab.cs | 2 +- src/SharpIDE.Godot/Features/Run/RunPanelTab.cs | 2 +- .../Features/TerminalBase/SharpIdeTerminal.cs | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/SharpIDE.Godot/Features/Debug_/Tab/DebugPanelTab.cs b/src/SharpIDE.Godot/Features/Debug_/Tab/DebugPanelTab.cs index 06f6241..b142b74 100644 --- a/src/SharpIDE.Godot/Features/Debug_/Tab/DebugPanelTab.cs +++ b/src/SharpIDE.Godot/Features/Debug_/Tab/DebugPanelTab.cs @@ -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); } }); } diff --git a/src/SharpIDE.Godot/Features/Run/RunPanelTab.cs b/src/SharpIDE.Godot/Features/Run/RunPanelTab.cs index 88d1c6f..8848a5c 100644 --- a/src/SharpIDE.Godot/Features/Run/RunPanelTab.cs +++ b/src/SharpIDE.Godot/Features/Run/RunPanelTab.cs @@ -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); } }); } diff --git a/src/SharpIDE.Godot/Features/TerminalBase/SharpIdeTerminal.cs b/src/SharpIDE.Godot/Features/TerminalBase/SharpIdeTerminal.cs index d440f7c..98c2d66 100644 --- a/src/SharpIDE.Godot/Features/TerminalBase/SharpIdeTerminal.cs +++ b/src/SharpIDE.Godot/Features/TerminalBase/SharpIdeTerminal.cs @@ -12,19 +12,18 @@ public partial class SharpIdeTerminal : Control var terminalControl = GetNode("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