From 563eace4877e6992a40655f01546ec33e4ac147a Mon Sep 17 00:00:00 2001 From: tznind Date: Sun, 13 Oct 2024 13:54:39 +0100 Subject: [PATCH] Mostly working for NetDriver --- Terminal.Gui/ConsoleDrivers/NetDriver.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Terminal.Gui/ConsoleDrivers/NetDriver.cs b/Terminal.Gui/ConsoleDrivers/NetDriver.cs index 1298c1c35..57f58297c 100644 --- a/Terminal.Gui/ConsoleDrivers/NetDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/NetDriver.cs @@ -407,6 +407,8 @@ internal class NetEvents : IDisposable return true; } + public AnsiResponseParser Parser { get; private set; } = new (); + // Process a CSI sequence received by the driver (key pressed, mouse event, or request/response event) private void ProcessRequestResponse ( ref ConsoleKeyInfo newConsoleKeyInfo, @@ -415,6 +417,16 @@ internal class NetEvents : IDisposable ref ConsoleModifiers mod ) { + if (cki != null) + { + // If the response is fully consumed by parser + if(cki.Length > 1 && string.IsNullOrEmpty(Parser.ProcessInput (new string(cki.Select (k=>k.KeyChar).ToArray ())))) + { + // Lets not double process + return; + } + } + // isMouse is true if it's CSI<, false otherwise EscSeqUtils.DecodeEscSeq ( EscSeqRequests, @@ -1036,6 +1048,15 @@ internal class NetDriver : ConsoleDriver } } + /// + public override IAnsiResponseParser GetParser () => _mainLoopDriver._netEvents.Parser; + + /// + public override void RawWrite (string str) + { + Console.Write (str); + } + internal override void End () { if (IsWinPlatform)